Is it me or is file.url a lot easier to use than file.nativePath
in Adobe AIR. Maybe I’m missing something because every tutorial or code snippet I can find uses file.nativePath
.
I’m busy building an AIR application that can be used on Windows and Mac OS. I have to take care of the file structure of both systems. After I test my application on a Mac I couldn’t load anything from it. The reason of this problem is that Mac needs “file://” in front of the file URL to load the file correct.
When I had this problem I searched the internet for a solution. I found very complex solutions at EverythingFlex and Snipplr. But then I start to examine the File object and found just the right file url (on the Mac it adds “file://” in front of the url) just accessible with File.url
. Then I tested it on Windows and it worked perfect.
I see no reason why I shouldn’t use this simple version of all the long code solutions that are available on the web. But like I said maybe I’m missing something?
I was wondering the exact same thing…
If someone has a clue!
The nativePath is formatted to a path the average user understands. Some users might see file:///C:/Program Files/… on windows and say: huh?
nativePath would read so they see C:Program Files… which would make sense to them.
I’ve always used nativePath when displaying a filepath to a user (like depicting a file they’ve chosen), and a url when you are loading that content into an Image component or something.
that sounds like a reasonable purpose to use nativePath. But why are the people of those scripts using file.nativePath instead of file.url?
Howdy – This is a great place
Just registered and wanted to say hello.
This saved my day Arno.
Thank you for this. Swapping .nativePath for .url has now made me all Mac compatible which gives me a nice warm feeling inside… or that may be the wine. But either way, thank you for your post, you’re a wonderful person.
And?? Did you miss something?
I too ran into the problem that my images did not load on a mac when i use nativepath as saved image urls.
Can i safely use url instead?