Skip to content

Commit

Permalink
Find Windows path
Browse files Browse the repository at this point in the history
Issue 650 (#650)
  • Loading branch information
neurolabusc committed Nov 21, 2022
1 parent 8f82dc1 commit be2f6c5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion console/nii_dicom.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ extern "C" {
#define kCPUsuf " " //unknown CPU
#endif

#define kDCMdate "v1.0.20221120"
#define kDCMdate "v1.0.20221121"
#define kDCMvers kDCMdate " " kJP2suf kLSsuf kCCsuf kCPUsuf

static const int kMaxEPI3D = 1024; //maximum number of EPI images in Siemens Mosaic
Expand Down
15 changes: 15 additions & 0 deletions console/nii_dicom_batch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8721,6 +8721,21 @@ void readFindPigz(struct TDCMopts *opts, const char *argv[]) {
}
if (is_exe(opts->pigzname))
return;
HMODULE hModule = GetModuleHandle(NULL);
if (hModule != NULL) {
// https://stackoverflow.com/questions/1528298/get-path-of-executable
char exepth[PATH_MAX];
GetModuleFileName(hModule, exepth, (sizeof(exepth)));
dropFilenameFromPath(exepth); //, opts.pigzname);
char appendChar[2] = {"a"};
appendChar[0] = kPathSeparator;
strcat(exepth, appendChar);
strcpy(opts->pigzname, "pigz.exe");
strcat(exepth, opts->pigzname);
strcpy(opts->pigzname, exepth);
}
if (is_exe(opts->pigzname))
return;
#ifdef myDisableZLib
printMessage("Compression requires %s in the same folder as the executable\n", opts->pigzname);
#else //myUseZLib
Expand Down

0 comments on commit be2f6c5

Please sign in to comment.