Page 1 of 1

Error of forward-slashes in Windows

Posted: Thu Jul 25, 2019 2:45 am
by fur
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:

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));
  ...
A workaround I currently doing, is replacing all forward-slashes to backward-slashes in Windows, added this in GetDirectoryPath() in ES3IO:

Code: Select all

#if UNITY_STANDALONE_WIN
  path = path.Replace("\\", "/"); // Replace all backward slashes into forward slahes in Windows
#endif
Please confirm this is the best approach and would be great if you add it in next version.

Re: Error of forward-slashes in Windows

Posted: Thu Jul 25, 2019 5:09 pm
by Joel
Hi there,

It looks like you're not using the latest version, as this has already been addressed. If you've tried updating, it might be that the Asset Store is distributing the wrong version to you. If you PM me your invoice number then I'll send over the update.

Note that we don't convert slashes in our fix as there are situations where back slashes are acceptable.

All the best,
Joel