Search code examples
macosfiledirectorylivecode

In my compiled Livecode desktop app, the PC version saves files and folders as expected. The Mac compiled version is all wrong


In my desktop app, I have a very defined file and folder structure:

main_folder ---folder2 ------file1 ------file2 ---folder3 ------file1 ------file2 etc...

On PC, this writes fine. I define the main folder and sub folders:

put "c:\folder1\folder2\file1" into someVariable

On Mac, I have:

put specialfolderpath("Documents") & "/folder1/folder2/file1" into someVariable

On PC, it writes the files to the folders as expected. On the Mac, it seems to write a folder/file combo:

/folder1/folder2/file1

as a file.

For the software to work, I copy the folder/file structure to the Mac as it is on the PC.

The Mac app is not finding the existing files and is then writing new files underneath the existing folders/files as new files.

It's all very confusing and I just don't understand why it's not working as it should.


Solution

  • LiveCode will create a new file if it cannot find an existing one.

    I don't think you can concatenate folders when using "specialFolderPath". Check out the dictionary, which only gives examples where a single folder is included.

    Try this:

    answer folder "Select Folder"
    put it into folderPath
    

    Check out what comes back in the local variable "it". Then test that.