Error of forward-slashes in Windows

Discussion and help for Easy Save 3
Post Reply
fur
Posts: 9
Joined: Fri Jul 28, 2017 6:12 am

Error of forward-slashes in Windows

Post 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.
User avatar
Joel
Moodkie Staff
Posts: 4826
Joined: Wed Nov 07, 2012 10:32 pm

Re: Error of forward-slashes in Windows

Post 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
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
Post Reply