Hello @ferdinand thank you for your response.
You have also tagged your posting as maxon API
although the types you are mentioning, HyperFile and FileName, are both classic API. What are the maxon API types you are using?
Yes, it should have been classic api
and not maxon api
.
Your question is a bit hard to answer in this form. I assume you are in some kind of NodeData plugin and must serialize and deserialize some data manually with NodeData::Read and NodeData::Write. In this context you are encountering the described behavior of Windows 'changing' the path delimiters written on MacOS.
I guess that answers my question.
But just in case, here is a simplified version of the code that hopefully illustrates better what is done:
class MyData: public iCustomDataType<MyData>
{
Filename _assetPath;
public:
Bool Read(HyperFile* hf, Int32 level) {
hf->ReadFilename(&_assetPath);
// inpsecting _assetPath and _assetPath.GetFile()
return TRUE;
}
Bool Write(HyperFile* hf, Int32 level) {
// inpsecting _assetPath
hf->WriteFilename(_assetPath);
return TRUE;
}
};
class MyDataDataType : public CustomDataTypeClass
{
INSTANCEOF(MyDataDataType , CustomDataTypeClass)
public:
virtual Bool WriteData(const CustomDataType* d, HyperFile* hf) {
return static_cast<const MyData*>(d)->Write(hf);
}
virtual Bool ReadData(CustomDataType* d, HyperFile* hf, Int32 level) {
return static_cast<MyData*>(d)->Read(hf, level);
}
};
So yes WriteFilename
and ReadFilename
are called for the serialization/deserialize process.
For completeness a slightly rephrased description of the observation from the initial question:
Project created on windows:
WriteData
is called and _assetPath
- that contains C:\Program Files\MyAssets\somefile.dat
(when inspecting it in Write
) - is written.
- opening that same project on windows then
_assetPath
is again C:\Program Files\MyAssets\somefile.dat
when inspected in Read
and _assetPath.GetFile()
returns somefile.dat
.
- copying that project to macOS and opening it there
_assetPath
is also C:\Program Files\MyAssets\somefile.dat
and _assetPath.GetFile()
returns C:\Program Files\MyAssets\somefile.dat
.
Project created on macOS:
WriteData
is called and _assetPath
- that contains /Library/Application Support/MyAssets/somefile.dat
when inspecting it in Write
- is written.
- opening that same project on macOS then
_assetPath
is again /Library/Application Support/MyAssets/somefile.dat
when inspected in Read
and _assetPath.GetFile()
returns somefile.dat
.
- copying that project to windows and opening it there
_assetPath
it now \Library\Application Support\MyAssets\somefile.dat
and _assetPath.GetFile()
returns somefile.dat
.
But based on your answer I think this behavior is expected.
Kind regards,
Till