create folder on a networked drive?

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
sms5138
Posts: 126
Joined: Mon Feb 23, 2015 11:49 pm

create folder on a networked drive?

Post by sms5138 » Tue Feb 23, 2016 2:59 pm

Hi everyone,

I'm using a bit of code that I was directed to previously by Klaus. I wondered if anyone here had any idea if it would be possible to use it on a network drive that has been mapped locally as Z:\

Here's what i've come up with so far, but i'm obviously missing something... just not sure what.

Code: Select all

function mkprefsfolder
   put specialfolderpath("Z:\Software\App") into spfp
   if there is not a folder (spfp & "/test") then
      create folder (spfp & "/test" )

   end if
   return (spfp & "/test/")
end mkprefsfolder

on mouseUp
mkprefsfolder
end mouseUp
I'm sure it's something silly, but can't seem to find anything about it.

Thanks in advance for any help you can provide.

-Sean

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9840
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: create folder on a networked drive?

Post by FourthWorld » Tue Feb 23, 2016 3:56 pm

The specialFolderPath function is for obtaining the path of specific folders - see its entry in the Dictionary for details.

You don't need that here - just use the path and you may be fine. If not, add a check of "the result" to know if an error occurs, with a call to sysError to determine the exact error the system is reporting, e.g.:

Code: Select all

create folder (spfp & "/test" )
if the result is not empty then
   answer "Couldn't create folder: "& the result &" ("& sysError() &")"
end if
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

sms5138
Posts: 126
Joined: Mon Feb 23, 2015 11:49 pm

Re: create folder on a networked drive?

Post by sms5138 » Tue Feb 23, 2016 6:49 pm

That helps quite a bit! I did get it to work.

Thanks so much!

-Sean

Klaus
Posts: 13829
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: create folder on a networked drive?

Post by Klaus » Tue Feb 23, 2016 7:43 pm

sms5138 wrote:...
I'm using a bit of code that I was directed to previously by Klaus.
...
And I also always propose to check the dictionary if in doubt! 8)

But my "mkprefsfolder" is a FUNCTION and you are calling it like a handler!
Sean, Sean, Sean... :D

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”