url file path

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
urbaud
Posts: 120
Joined: Tue Feb 24, 2009 12:10 am

url file path

Post by urbaud » Sun Dec 12, 2010 2:12 am

How do I show the current file name and path using the URL file notation? I want to show the file name in a label field and show the file's path in another label field.

1. get url "file:myDataFile2"
2. put the longFilePath of it into fld "l1"
3. put url "file:myDataFile2" into fld "t1"

If I use line 2, it puts the contents of the file into the label field-I just want the path.
urbaud

WaltBrown
Posts: 466
Joined: Mon May 11, 2009 9:12 pm

Re: url file path

Post by WaltBrown » Sun Dec 12, 2010 9:01 am

urbaud,
I don't understand what you are trying to do. The "get url file" function needs a path as well, so your path is in the defaultFolder function. You already have the file name. So it appears what you want to do is (and you don't need URL notation):

Code: Select all

put "myDataFile2" into fld "l1"
put the defaultFolder into fld "t1"
Or is there more to the question?

The longFilePath function is only for Windows. If you had a Windows path in the 8.3 format in a variable named tMyOldPath , then you might use:

Code: Select all

put the longFilePath of tMyOldPath into tMyNewPath
set the itemDelim to "/"
put the last item of tMyNewPath into fld "l1"
delete the last item of tMyNewPath
put tMyNewPath into fld "t1"
or something like that.

Walt
Walt Brown
Omnis traductor traditor

urbaud
Posts: 120
Joined: Tue Feb 24, 2009 12:10 am

Re: url file path

Post by urbaud » Sun Dec 12, 2010 9:34 pm

Hi Walt,
Thanks for responding to my post. I found your suggestions helpful and the info about the longFilePath being used only with windows is something I didn't know about, as I'm somewhat new to Rev. I also realized, again, from your suggestions, that I should use the defaultFolder function. So, thanks again for your help.

Dan
urbaud

Post Reply