Skip to content

Commit d38a5f7

Browse files
authored
Fix bugs running inspectNwbFile on Windows (#698)
* Update inspectNwbFile.m * Fix typo
1 parent 7d4e43e commit d38a5f7

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

inspectNwbFile.m

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,14 @@
7474

7575
elseif hasCliNwbInspector
7676
reportFilePath = [tempname, '.json'];
77-
systemCommand = sprintf('%s %s --levels importance --json-file-path %s', ...
78-
nwbInspectorExecutable, nwbFilepath, reportFilePath);
79-
77+
if isunix
78+
systemCommand = sprintf('%s %s --levels importance --json-file-path %s', ...
79+
nwbInspectorExecutable, nwbFilepath, reportFilePath);
80+
elseif ispc
81+
% Use double quotes in case there are spaces in the filepaths
82+
systemCommand = sprintf('"%s" "%s" --levels importance --json-file-path "%s"', ...
83+
nwbInspectorExecutable, nwbFilepath, reportFilePath);
84+
end
8085
[status, m] = system(systemCommand);
8186

8287
assert(status == 0, ...
@@ -190,10 +195,18 @@
190195
if isunix
191196
systemCommand = sprintf('which %s', nwbInspectorExecutable);
192197
elseif ispc
193-
systemCommand = sprintf('where %s', nwbInspectorExecutable);
198+
if isfile([nwbInspectorExecutable, '.exe'])
199+
% If the nwbexecutable exists as a file, we have the absolute
200+
% path and don't need to check with the where command
201+
isNwbInspectorInstalled = true;
202+
return
203+
else
204+
systemCommand = sprintf('where "%s"', nwbInspectorExecutable);
205+
end
194206
end
195207
assert(logical(exist('systemCommand', 'var')), ...
196208
'Unknown platform, could not generate system command. Please report!')
197209
[status, ~] = system(systemCommand);
210+
198211
isNwbInspectorInstalled = status == 0;
199212
end

0 commit comments

Comments
 (0)