Relative File Paths
esmaras
String newCSVFolder = "::Data:"
NewPath/C/O saveFolder, location + newCSVFolder
<pre><code class="language-igor">
an error message is generated. The message says "The operation could not be completed because Windows OS error - Access Denied. Do you want help?"
When I change the String newCSVFolder to the full path name, the procedure performs precisely as I want it to.
NewPath/C/O saveFolder, location + newCSVFolder
<pre><code class="language-igor">
an error message is generated. The message says "The operation could not be completed because Windows OS error - Access Denied. Do you want help?"
When I change the String newCSVFolder to the full path name, the procedure performs precisely as I want it to.
This makes me think that location is an empty string.
The path passed to NewPath must be a full path because Igor has no concept of a current directory.
Assuming that you know what your relative path is relative to, you should be able to convert your relative path to a full path.
If this does not solve the problem then create a demo function that illustrates the problem and specifies what you mean by "location" and what you want the path to be relative to.
August 7, 2014 at 12:11 pm - Permalink
August 7, 2014 at 03:01 pm - Permalink
Yes. Here is how you do it:
// Returns colon-separated path to experiment's home folder with trailing colon
// or "" if there is no home folder.
Function/S FullPathToHomeFolder()
PathInfo home
if (V_flag == 0)
// The current experiment was never saved so there is no home folder
return ""
endif
String path = S_path
return path
End
Function CreateFolderInHomeFolder(folderName, symbolicPathName)
String folderName // Name of folder to be created
String symbolicPathName // Name to use for the symbolic path
String fullPath = FullPathToHomeFolder()
if (strlen(fullPath) == 0)
// Error - there is no home folder because the current experiment was never saved
return -1
endif
fullPath += folderName
NewPath/O/C $symbolicPathName, fullPath
return 0 // Success
End
August 7, 2014 at 03:56 pm - Permalink
August 11, 2014 at 01:34 pm - Permalink