Fix duplication of new paths
This commit is contained in:
5
main.go
5
main.go
@@ -9,6 +9,7 @@ import (
|
|||||||
"net/url"
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
_ "github.com/mattn/go-sqlite3"
|
_ "github.com/mattn/go-sqlite3"
|
||||||
@@ -96,8 +97,10 @@ func main() {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
newEntry := Entry{
|
newEntry := Entry{
|
||||||
FolderURI: path.Clean(path.Join(folder, fileEntry.Name())),
|
FolderURI: filepath.ToSlash(path.Clean(path.Join(folder, fileEntry.Name()))),
|
||||||
}
|
}
|
||||||
|
// Lowercase disk letters... Because it's what vscode would have wanted
|
||||||
|
newEntry.FolderURI = strings.ToLower(newEntry.FolderURI[:1]) + newEntry.FolderURI[1:]
|
||||||
_, exists := cleanConfig[newEntry.FolderURI]
|
_, exists := cleanConfig[newEntry.FolderURI]
|
||||||
if exists {
|
if exists {
|
||||||
log.Printf("Folder %s already exists in config", newEntry.FolderURI)
|
log.Printf("Folder %s already exists in config", newEntry.FolderURI)
|
||||||
|
12
types.go
12
types.go
@@ -4,12 +4,12 @@ type Config struct {
|
|||||||
Entries []Entry `json:"entries"`
|
Entries []Entry `json:"entries"`
|
||||||
}
|
}
|
||||||
type Entry struct {
|
type Entry struct {
|
||||||
FolderURI string `json:"folderUri,omitempty"`
|
FolderURI string `json:"folderUri,omitempty"`
|
||||||
Workspace Workspace `json:"workspace,omitempty"`
|
Workspace *Workspace `json:"workspace,omitempty"`
|
||||||
FileURI string `json:"fileUri,omitempty"`
|
FileURI string `json:"fileUri,omitempty"`
|
||||||
Label string `json:"label,omitempty"`
|
Label string `json:"label,omitempty"`
|
||||||
}
|
}
|
||||||
type Workspace struct {
|
type Workspace struct {
|
||||||
ID string `json:"id"`
|
ID string `json:"id,omitempty"`
|
||||||
ConfigPath string `json:"configPath"`
|
ConfigPath string `json:"configPath,omitempty"`
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user