Absolutepath is Deprecated

Ok… replace with Nativepath…

But…in OSX

SHELLPATH returns /xxx/yyy/zzz
NATIVEPATH returns the exact same thing
ABSOLUTEPATH returns xxx:yyy:zzz

the format with “:” is what is required by most AppleScript functions, yet is is being removed?
Or is NATIVEPATH currently returning the WRONG value and is going to change to “:” next release?

Not true in all cases. ShellPath escapes characters that can’t safely be passed to a shell, like spaces. NativePath does not and is simply the POSIX path to the file.

Deprecated doesn’t mean being removed. And for what it’s worth, you don’t need HFS-style paths to deal with AppleScript. See Aliases and Files from the AppleScript Language Guide.

It’s behaving correctly.

Thanks … changed the Applescript to use POSIX and NATIVEPATH and it works

[quote=21348:@Joe Ranieri]Not true in all cases. ShellPath escapes characters that can’t safely be passed to a shell, like spaces. NativePath does not and is simply the POSIX path to the file.

Deprecated doesn’t mean being removed. And for what it’s worth, you don’t need HFS-style paths to deal with AppleScript. See Aliases and Files from the AppleScript Language Guide.

It’s behaving correctly.[/quote]

Well Joe it seems that in my case it does not behaves correctly , i have a RealBasic project that i have to convert to XOJO and i replaced all the AbsolutePath with NativePath and once i open first time the preference file with the xojo, it replaces :users:username:documents:thefolder with /users/username/documents/thefolder and than it crashes the app because it cannot find the specific folder. if i start the old rs software as well it crashes because it does not find the folder as well.

Off topic, does it matters that i`m opening the old rsd files with xojo and i state in the code that instead of RealSQLDatabase are SQLiteDatabase ? it affects the structure or it corrupts the data ? we have few hundreds of clients and the xojo upgrade should not ruin the database or the data that the clients have locally.

In general, I recommend starting a new conversation rather than piggy-backing on a 1.5 year old one that may not be directly related.

With that said, it seems unlikely that NativePath is not working correctly. It is more likely that some part of your code is depending on the old style and is failing (perhaps with an exception) when you switched to the new style. FolderItem access should never crash an app if you are catching exceptions. In the new conversation, post a sample of the code that is now crashing your app.

Both of those are SQLite3 format databases, so there is no difference in structure. As far as code goes, there is some differences in how transaction processing is done. Also rowids without a specific primary key might cause issues with RecordSet.Update.

case "folder" sFolderItem = new folderItem(recSet.field("value").stringValue) if not(sFolderItem.exists) then msgbox("Folder does not exist.") else app.sFolderItem = new folderItem(recSet.field("value").stringValue)

and in the debug on run if i look on the recSet (record set ) output i get as a response for the value field SSD:Users:aurelian:Documents:Srg , if i run the code with this path the app works perfectly, once i start the xojo app with the native path the database changes to /Users/aurelian/Documents/Srg and the statement trows the “Folder does not exist.” messagebox.

In this case what should i do ? it is related to the Path changes or to FolderItem . once first time the app runs the old app crashes and the old one as well.

Well to answer my own question , it seems that sFolderItem = new folderItem(recSet.field("value").stringValue, FolderItem.PathTypeNative) fixed the issue. so maybe it will be help for others that face the same issue.

Thanks again.

Yes, that is the correct fix for your code. The second parameter of the constructor defaults to PathTypeAbsolute, but you were passing it a NativePath.

Now you are correctly telling the constructor that you are passing in a NativePath, so things work as expected.