From 3b053905e6e1d559e42973835808d928b70f3b26 Mon Sep 17 00:00:00 2001 From: Chris Rorden Date: Fri, 22 Apr 2016 07:31:31 -0400 Subject: [PATCH] Use "getcwd" for relative path --- console/nii_dicom_batch.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/console/nii_dicom_batch.cpp b/console/nii_dicom_batch.cpp index d3e72d68..964a7750 100755 --- a/console/nii_dicom_batch.cpp +++ b/console/nii_dicom_batch.cpp @@ -87,7 +87,12 @@ void dropFilenameFromPath(char *path) { // strcpy(path,""); } else path[dirPath - path] = 0; // please make sure there is enough space in TargetDirectory - if (strlen(path) == 0) strcat (path,"."); //relative path - use cwd + if (strlen(path) == 0) { //file name did not specify path, assume relative path and return current working directory + //strcat (path,"."); //relative path - use cwd <- not sure if this works on Windows! + char cwd[1024]; + getcwd(cwd, sizeof(cwd)); + strcat (path,cwd); + } }