I've hit a bit of a wall when it comes to file manipulation. I've got everything else working so far, but I want to make my app change the name of the text file associated with the saved sudoku to something that says completed in it, so I can archive it away from the user, but still be available if they want it down the line.
For example, I have a sudoku saved to a file "WX823TZ.txt", and when the user completes it, I want my stack to change that file to "WX823TZ-COMPLETED.txt"
Now, I read the file and close it, so that's no issue, and when the sudoku gets completed I'm able to do the following code:
Code: Select all
if completed and Creator=0 then
put folderPath into NewFileName -- folderPath, unsurprisingly, contains the folder path of the current sudoku
replace ".txt" with "-COMPLETED.txt" in NewFileName
rename folderPath to NewFileName
end if
However when I try, it just makes the same file name as before, WX823TZ.txt, and WX823TZ-COMPLETED.txt is also still there for some reason.
Am I missing something really obvious with the rename command, because as far as I can tell, there should only ever be the WX823TZ-COMPLETED.txt file, no matter how many times the handler gets called, no?
Many thanks in advanced!