When a user picks a location to save a project, there is a possibility that they'll save it in a folder under the root solution folder, but then again there is a possibility that the user will choose a completely separate folder, hell even drive, and thus my question is how can I detect that a file is placed in a path that is relative to the solution folder.
For example if I have a solution folder of X:\Xenon Software Development Kit '13 and inside that I have a folder called Compiled Files and inside that I store my XenonSDK.rev file, how can I figure out the relative path whilst offering the choice of storing to a folder that is outside the scope of my solution folder and being as cross platform as possible.
I've tried making use of the Replace command in the form of the following:
Code: Select all
Put SdkGetSolutionProperty("cSolutionFolder") Into tSolutionFolder // This is the file path of the solution minus the filename. e.g. X:/Xenon Software Development Kit '13
Replace BackSlash With Slash In tSolutionFolder
Replace BackSlash With Slash In pPath // pPath contains the full file path that the OS gave us from the Ask dialog. e.g. X:/Xenon Software Development Kit '13/Project Files/LiveCode/XenonSDK.rev
Replace tSolutionFolder With Empty In pPath // Yields things like /Project Files/LiveCode Stacks/XenonSDK.rev which I think would probably break Unix based file paths and I cannot remove the forward slash because again it could break legit paths such as /root/Documents