Page 1 of 1

Correct way to write the file path

Posted: Thu Mar 13, 2014 8:39 pm
by magice
It seems like i fight with file paths every time I have to include them. I am trying to evaluate if there is a file in a specific folder on a network drive, and i seem to be doing it wrong, What would be the proper way to write this?

Code: Select all

if there is a file "W:My_folder/My_SubFolder/MyTextFile.txt"
  then
    doStuff
end if

Re: Correct way to write the file path

Posted: Thu Mar 13, 2014 10:50 pm
by Simon
Hi magice,
For Windows I just right click on the file and select properties which shows the path to the file. In the case of my network drive I see that though I have it mapped to Z: it actually uses //name(?) of the drive. I have a feeling that this might have something to do with the particular drive software.
For Mac use get info.

Simon

Re: Correct way to write the file path

Posted: Fri Mar 14, 2014 3:46 pm
by magice
Simon,
This app will be used in Windows. When you use windows properties to get the location, it gives it to you in the dos format with backslashes. I am pretty sure I have always changed those to forward slashes to work in livecode. The question is, what else do I need to do to make the above evaluation work, or is the syntax correct and my app isn't working for some other unknown reason? Does it need "file:" or some other specification in the path?

Re: Correct way to write the file path

Posted: Fri Mar 14, 2014 5:38 pm
by jacque
To easily get a file path, do this in the multi-line message box:

Code: Select all

answer file "Choose a file:"
put it
That should give you the correct path in the correct format for LiveCode.

Re: Correct way to write the file path

Posted: Fri Mar 14, 2014 8:42 pm
by magice
Thank you all. It turns out that I had it right all along. It seems that I am having firewall issues on the network drive.