Faking stack file extensions
Posted: Sat Jun 10, 2017 10:01 pm
When asked to create a cross-platform version of a 30-year old Windows-only psychological testing app, I insisted upon using LC (which worked flawlessly when I rewrote by own 1990s-era Mac-only Prograph-based testing app as cross-platform).
The client insists upon maintaining the original folder/file organization: a folder that includes both the app/.exe and a template for saving the data, with a subfolder (dubbed “ClientData”) into which a copy of the template can be saved for storing an individual client’s test responses. For simplicity, I prefer to use a LC stack file as the template into which test responses are entered.
The revCopyFile works fine to create a copy of the template in the subfolder, but the rename command just doesn’t seem to work.
Klaus (and others) provided a very helpful lead in suggesting instead using
put url("binfile:" & tSourcePath) into url("binfile:" & tDestinationPath)
The thing is that this creates an empty file in the subfolder, rather than a copy of the data stack file.
Apparently, the problem is that my template and copy employed a fake extension (.hrm) in place of the original .livecode.
When the files and paths employ the original extension .livecode, everything seems to work fine: I can open and save the newly created data stack file from the path saved in a custom property in the main stack.
Bottom line: Although it’s not the worst disaster to employ the .livecode extension for the template file and its copies, it would be more elegant to identify these files with a fake custom extension.
Any advice regarding whether, how, or when to change the .livecode extension during these file path manipulations would be much appreciated.
Thanks much for any insights.
jeff k
The client insists upon maintaining the original folder/file organization: a folder that includes both the app/.exe and a template for saving the data, with a subfolder (dubbed “ClientData”) into which a copy of the template can be saved for storing an individual client’s test responses. For simplicity, I prefer to use a LC stack file as the template into which test responses are entered.
The revCopyFile works fine to create a copy of the template in the subfolder, but the rename command just doesn’t seem to work.
Klaus (and others) provided a very helpful lead in suggesting instead using
put url("binfile:" & tSourcePath) into url("binfile:" & tDestinationPath)
The thing is that this creates an empty file in the subfolder, rather than a copy of the data stack file.
Apparently, the problem is that my template and copy employed a fake extension (.hrm) in place of the original .livecode.
When the files and paths employ the original extension .livecode, everything seems to work fine: I can open and save the newly created data stack file from the path saved in a custom property in the main stack.
Bottom line: Although it’s not the worst disaster to employ the .livecode extension for the template file and its copies, it would be more elegant to identify these files with a fake custom extension.
Any advice regarding whether, how, or when to change the .livecode extension during these file path manipulations would be much appreciated.
Thanks much for any insights.
jeff k