|
70 | 70 |
|
71 | 71 | if resolvedPath == ""
|
72 | 72 | % If the given path does not exist, it is likely due to
|
73 |
| - % trailing directories not existing yet. Resolve parent |
74 |
| - % directory's path, and append child directory. |
| 73 | + % trailing directories not existing yet. Try to resolve its |
| 74 | + % parent path. |
75 | 75 | [pathToParentFolder, child, ext] = fileparts(path);
|
76 | 76 |
|
77 | 77 | if pathToParentFolder==path
|
78 |
| - % If the path was not resolved and we are not able to |
79 |
| - % exract a different parent path, we have failed to |
80 |
| - % resolve a full path |
81 |
| - error("MATLAB:Zarr:invalidPath",... |
82 |
| - "Unable to access path ""%s"".", path) |
| 78 | + % If the path was not resolved and it is the same as |
| 79 | + % its parent path, then we have failed to resolve a |
| 80 | + % full path. This likely indicates a problem. |
| 81 | + resolvedPath = ""; |
| 82 | + return |
83 | 83 | end
|
84 | 84 |
|
| 85 | + % Resolve parent directory's path, and append child directory. |
85 | 86 | resolvedParentPath = Zarr.getFullPath(pathToParentFolder);
|
86 | 87 | resolvedPath = fullfile(resolvedParentPath, child+ext);
|
87 | 88 | end
|
|
104 | 105 | % Get the parent path
|
105 | 106 | [pathToParentFolder, ~, ~] = fileparts(path);
|
106 | 107 | if pathToParentFolder == path
|
107 |
| - % If the path is not an existing folder and it has no |
108 |
| - % parent folder, we have failed to find an existing parent |
109 |
| - % folder. This likely indicates a problem. |
| 108 | + % If the path is not an existing folder and it is the same |
| 109 | + % as its parent path, we have failed to find an existing |
| 110 | + % parent folder. This likely indicates a problem. |
110 | 111 | existingParent = "";
|
111 | 112 | return
|
112 | 113 | end
|
113 |
| - % Continue recursing until an exisiting parent path is found |
| 114 | + % Continue recursing until an existing parent path is found |
114 | 115 | existingParent = Zarr.getExistingParentFolder(pathToParentFolder);
|
115 | 116 |
|
116 | 117 | end
|
@@ -187,8 +188,13 @@ function makeZarrGroups(existingParentPath, newGroupsPath)
|
187 | 188 | obj.KVStoreSchema = py.ZarrPy.createKVStore(obj.isRemote, objectPath, bucketName);
|
188 | 189 |
|
189 | 190 | else % Local file
|
190 |
| - % use full path |
| 191 | + % Use full path |
191 | 192 | obj.Path = Zarr.getFullPath(path);
|
| 193 | + if obj.Path == "" |
| 194 | + % Error out if the full path could not be resolved |
| 195 | + error("MATLAB:Zarr:invalidPath",... |
| 196 | + "Unable to access path ""%s"".", path) |
| 197 | + end |
192 | 198 | obj.KVStoreSchema = py.ZarrPy.createKVStore(obj.isRemote, obj.Path);
|
193 | 199 | end
|
194 | 200 | end
|
|
0 commit comments