I have a stored file name that I got via replace(f1.nativepath, f2.nativepath) where f2 is the parent folder.
It is stored as /Grammar List.txt . I have this line which works elsewhere
pf = IniHerd.ThColl.Child(ts)
pf is folderitem result. ts is the string. ThColl is the parent.
For some reason this : is being added after the / like this.
If I add .nativepath after the (ts) it won’t be accepted.
Suggestions?
I’m not sure that I’m exactly following what you are trying to do with your code, but just FYI, “/” is a valid character in a file name in macOS, but it will be replaced by “:” in a native path due to “/” being reserved as a directory separator.
Trying to be more clear, a file on the desktop named “/test.txt” will result in the following path strings:
thanks. Unfortunately it’s good and bad.
It’s bad because the other file, “inipaths.ini”, I loaded so far by .child method doessn’t have the : in the nativepath.
It also was declared “inipaths.ini” and without the /
Just to clarify. MacOs added the :
I think the issue is that you are using Replace to get the file name when you should just be using “FolderItem.Name”
For example:
If your file path is “/Users/name/Desktop/test.txt” and your parent path is “/Users/name/Desktop”
Then using replace to remove the parent path from the file path will result in “/test.txt” since the parent path does not end with “/”
Thanks. I was trying to figure out previous code that removed the / or \
What I did elsewhere with other filenames was remove the file separator ( / or \ ) from the path, and I wouldn’t get the protest. This was also used for a partial path (the parent was several folders above the actual file).
I couldn’t find anything under the child method requiring it or not. Nor could I find anything under name.