save file data writes to bundle.

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
reelstuff
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 254
Joined: Mon Apr 16, 2007 12:06 am
Contact:

save file data writes to bundle.

Post by reelstuff » Fri Jun 20, 2008 1:45 pm

I have a script, that is intended to create a folder and write a file to that
folder to be used later to verify a license file.

Currently the folder is being created in the bundle directory, which I expect the script is doing what it is told, however,

the file is blank when written to the folder.

Which baffles me, so I thought that perhaps it would be better to create the folder
in the directory where the application is installed instead of the bundle file.

This is MAC, windows I dont think has this issue.

As it just creates the folder along side the exe file.

So this script works with windows but not MAC due to some write issue in the bundle or at least that is my guess.

So how would I create a folder along side the application instead of inside the bundle?

Code: Select all

on saveRegFileGen
  put the effective filename of this stack into tPath
set the itemDelimiter to "/"
put "regFileGen/" into last item of tPath
if there is not a folder tPath then create folder tPath
set the filetype to ""
put fld Field_regData1 into URL ("file:" & tPath & "RegData")
wait 5 ticks
end saveRegFileGen
Thanks in advance for any suggestions

Tim

Klaus
Posts: 14194
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Post by Klaus » Fri Jun 20, 2008 1:52 pm

Hi reelstuff,

check "the result" immediately after creating the folder and after writing the file!

It should be empty on success and contain a description of the error, which is mostly "can't create directory", which probably means the current user does not have write permission here.

HINT:
Use
specialfolderpath("preferences")
or the users home directory to store any data outside the app!
There you definitively have write permission!


Best

Klaus

reelstuff
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 254
Joined: Mon Apr 16, 2007 12:06 am
Contact:

Thank you

Post by reelstuff » Fri Jun 20, 2008 2:13 pm

HI, thank you That explains what I was missing, I will have a go at that approach.

Tim

Post Reply