Commit dadb144
committed
Ignore invalid symlinks for files that would be skipped anyway
Previously, SketchLoad would error out on *any* error during file
enumeration, including broken symlinks (where `os.Stat` returns
`ErrNotExist`), even when that symlink would not be loaded (i.e. no
valid extension) anyway.
Now, `ErrNotExist` errors are ignored and a broken symlink is processed
as normal. This changes the code to assume broken symlinks are not
directories and to use the `path` value instead of the `info.Name()`,
since the latter is not available when the `Stat()` call failed.
If, based on the name of the broken symlink, the file would be skipped,
processing continues as normal. If the file would be loaded, then the
existing `os.Open()` call fails (and since the previous commit, returns
an error like before for all broken symlinks).1 parent d4c259f commit dadb144
1 file changed
+6
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
154 | 154 | | |
155 | 155 | | |
156 | 156 | | |
157 | | - | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
158 | 161 | | |
159 | 162 | | |
160 | 163 | | |
161 | 164 | | |
162 | | - | |
| 165 | + | |
163 | 166 | | |
164 | 167 | | |
165 | 168 | | |
| |||
182 | 185 | | |
183 | 186 | | |
184 | 187 | | |
185 | | - | |
| 188 | + | |
186 | 189 | | |
187 | 190 | | |
188 | 191 | | |
| |||
0 commit comments