Correct way to write the file path

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
magice
Posts: 457
Joined: Wed Mar 18, 2009 12:57 am

Correct way to write the file path

Post by magice » Thu Mar 13, 2014 8:39 pm

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

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: Correct way to write the file path

Post by Simon » Thu Mar 13, 2014 10:50 pm

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
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

magice
Posts: 457
Joined: Wed Mar 18, 2009 12:57 am

Re: Correct way to write the file path

Post by magice » Fri Mar 14, 2014 3:46 pm

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?

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7393
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Correct way to write the file path

Post by jacque » Fri Mar 14, 2014 5:38 pm

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.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

magice
Posts: 457
Joined: Wed Mar 18, 2009 12:57 am

Re: Correct way to write the file path

Post by magice » Fri Mar 14, 2014 8:42 pm

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.

Post Reply