Error of forward-slashes in Windows
Posted: Thu Jul 25, 2019 2:45 am
In Windows, I got the errors of "A directory path with forward-slashes was expected, but given path was...".
This happens when I use C# 's fileInfo.FullName, it returns a path that using forward-slashes:
A workaround I currently doing, is replacing all forward-slashes to backward-slashes in Windows, added this in GetDirectoryPath() in ES3IO:
Please confirm this is the best approach and would be great if you add it in next version.
This happens when I use C# 's fileInfo.FullName, it returns a path that using forward-slashes:
Code: Select all
string fileExtensionWildcardSelector = "*" + MODEL_DATA_FILE_EXTENSION;
FileInfo[] modelDataFileInfos = parentDirectory.GetFiles(fileExtensionWildcardSelector, SearchOption.AllDirectories);
if (modelDataFileInfos != null && modelDataFileInfos.Length > 0) {
Hashtable hashtable = (Hashtable)MiniJSON.jsonDecode(ES3.LoadRawString(modelDataFileInfos[0].FullName));
...
Code: Select all
#if UNITY_STANDALONE_WIN
path = path.Replace("\\", "/"); // Replace all backward slashes into forward slahes in Windows
#endif