Fix files being linked as folders
This commit is contained in:
16
.vscode/launch.json
vendored
Normal file
16
.vscode/launch.json
vendored
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
// Use IntelliSense to learn about possible attributes.
|
||||||
|
// Hover to view descriptions of existing attributes.
|
||||||
|
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||||
|
"version": "0.2.0",
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"name": "Ereshor Workspace",
|
||||||
|
"type": "go",
|
||||||
|
"request": "launch",
|
||||||
|
"mode": "auto",
|
||||||
|
"program": "${workspaceFolder}",
|
||||||
|
"cwd": "C:\\Users\\Administrator\\Seafile\\Games-Ereshor"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
@@ -337,14 +337,11 @@ func ExpandPattern(source, workdir, target string) (links []LinkInstruction, err
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, file := range files {
|
for _, file := range files {
|
||||||
if info, err := os.Stat(file); err == nil && info.IsDir() {
|
|
||||||
// We don't care about matched directories
|
|
||||||
// We want files within them
|
|
||||||
if len(files) == 1 {
|
if len(files) == 1 {
|
||||||
// Special case: if there is only one file, and it's a directory
|
// Special case: if there is only one file
|
||||||
// This should only ever happen if our source is a path (and not a glob!)
|
// This should only ever happen if our source is a path (and not a glob!)
|
||||||
// And our target is a path, a directory
|
// And our target is a path
|
||||||
// ...but it will also happen if the source IS a glob and it happens to match ONE directory
|
// ...but it will also happen if the source IS a glob and it happens to match ONE file
|
||||||
// I think that should happen rarely enough to not be an issue...
|
// I think that should happen rarely enough to not be an issue...
|
||||||
links = append(links, LinkInstruction{
|
links = append(links, LinkInstruction{
|
||||||
Source: filepath.Join(static, file),
|
Source: filepath.Join(static, file),
|
||||||
@@ -352,6 +349,9 @@ func ExpandPattern(source, workdir, target string) (links []LinkInstruction, err
|
|||||||
})
|
})
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
if info, err := os.Stat(file); err == nil && info.IsDir() {
|
||||||
|
// We don't care about matched directories
|
||||||
|
// We want files within them
|
||||||
LogInfo("Skipping directory %s", file)
|
LogInfo("Skipping directory %s", file)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user