I’m sure this is entirely on me, but I’m loading a JSON file that is filled with relative path filenames. I have a FolderItem which I use as the “project root”, and was expecting to be able to do things like:
var f as FolderItem = root.Child(json.Value("imagePath").StringValue)
However, if - for example - the JSON imagePath
is something like "data/images/logo.png"
, after calling root.Child
the resulting FolderItem is now:
"/My/Project/root/data:images:logo.png"
Which is obviously very unusable and the file isn’t found. If I loop with a .Split("/")
and individually append each child item then it works as expected.
Is there a way for me to do what I want here without having to manage OS-dependent path separators and splitting myself?
7 posts - 5 participants