Unixpath( and High Sierra


#1

Saw there was a problem in October, have a similar problem.
Trying to save a file into a different folder than the one I’m working in.
Working in the Member_X folder, want to Save to ThanksData folder.

This:
lvSeatsFolder=unixpath(":Documents:CAPRI WORK:FUNDRAISING:SEATS 2017:LETTERS SENT:ThanksData:")

Results in this:
/Users/martin older/Documents/CAPRI WORK/MEMBERDB_X/Documents/CAPRI WORK/FUNDRAISING/SEATS 2017/LETTERS SENT/ThanksData

It is sticking the path of the MEMBERDB_X folder onto the path of the lvSeatsFolder

This worked until High Sierra, so assuming a bug, not user error.


#2

I don’t see how this could be possible. If this was true, Panorama would not be able to open any file ever.


#3

Sorry, IMHO this is an user error:

Your HFS path starts with a colon, meaning this path is relative to the active database; it is starting from the folder where your database is sitting.

So the result of the unixpath( function is calculated correctly, but the path is wrong.


#4

I seem to be getting a reputation for doing the impossible:face_with_raised_eyebrow:
Tried it with and without the colon at work and got the same result.
Just tried it at home where I’m on El Capitain and got the same result. The folders are set up a little different at home, but that shouldn’t matter with the below code.

Here’s the code:
Selectall
removeallsummaries
lvSeatsFolder=unixpath(“Documents:CAPRI WORK:FUNDRAISING:SEATS 2017:LETTERS SENT:ThanksData:”)
message lvSeatsFolder
clipboard()=lvSeatsFolder
stop

Here’s the clipboard:
/CAPRI WORK/MEMBERDB/Documents/CAPRI WORK/FUNDRAISING/SEATS 2017/LETTERS SENT/ThanksData

and here’s the screenshot of the message:
47 AM

Am I missing something obvious?


#5

I think you would get the expected result if you give it a full path (including the volume).

I like to use Panorama X functions for the higher parts of the folder hierarchy. In your example case I would use

info("Documentsfolder")+"CAPRI WORK/FUNDRAISING/SEATS 2017/LETTERS SENT/ThanksData/"

#6

Back at work with High Sierra. Your method does produce the expected result. But there is something buggy, or at least not what I expect, using unixpath(

This:
lvSeatsFolder=info(“DocumentsFolder”)+unixpath(“CAPRI WORK:FUNDRAISING:SEATS 2017:LETTERS SENT:ThanksData:”)

results in this:
/Users/martin older/Documents//Users/martin older/Documents/CAPRI WORK/MEMBERDB_X/CAPRI WORK/FUNDRAISING/SEATS 2017/LETTERS SENT/ThanksData

This, however, produces the expected result:

lvSeatsFolder=unixpath(info(“DocumentsFolder”)+“CAPRI WORK:FUNDRAISING:SEATS 2017:LETTERS SENT:ThanksData:”)

results in this:
/Users/martin older/Documents/CAPRI WORK/FUNDRAISING/SEATS 2017/LETTERS SENT/ThanksData

And just for fun, adding the colon as was discussed in your previous post, proves you correct about unixpath( calculating.:

This:
lvSeatsFolder=info(“DocumentsFolder”)+unixpath(":CAPRI WORK:FUNDRAISING:SEATS 2017:LETTERS SENT:ThanksData:"

Results in this:
/Users/martin older/Documents//Users/martin older/Documents/CAPRI WORK/MEMBERDB_X/CAPRI WORK/FUNDRAISING/SEATS 2017/LETTERS SENT/ThanksData

I haven’t tried running from different locations, say not in the documents folder, but it appears unixpath( automatically is adding the path to the Documents folder.


#7

You never want to do that. The unixpath( function automatically adds the path to the currently active database, resulting in a complete path. If you stick something else on the beginning, you’ll definitely get a wrong path.

Like Kurt, I think you are making some kind of user error, but I can’t tell what it is without seeing the entire structure of your hard disk, and where the current database is positioned within that structure.

In any case, the unixpath( function is really only included for compatibility with Panorama 6, where it was usually used for setting up shell commands or code in an AppleScript. I would recommend not using this function, it’s really not needed any more, as shown by Kurt’s example. In my own applications, I also avoid using hfs format paths (with colons). They work, but it can be confusing, I find it simpler to switch over to using unix paths everywhere.