Fix duplication of new paths
This commit is contained in:
5
main.go
5
main.go
@@ -9,6 +9,7 @@ import (
|
||||
"net/url"
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
_ "github.com/mattn/go-sqlite3"
|
||||
@@ -96,8 +97,10 @@ func main() {
|
||||
continue
|
||||
}
|
||||
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]
|
||||
if exists {
|
||||
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"`
|
||||
}
|
||||
type Entry struct {
|
||||
FolderURI string `json:"folderUri,omitempty"`
|
||||
Workspace Workspace `json:"workspace,omitempty"`
|
||||
FileURI string `json:"fileUri,omitempty"`
|
||||
Label string `json:"label,omitempty"`
|
||||
FolderURI string `json:"folderUri,omitempty"`
|
||||
Workspace *Workspace `json:"workspace,omitempty"`
|
||||
FileURI string `json:"fileUri,omitempty"`
|
||||
Label string `json:"label,omitempty"`
|
||||
}
|
||||
type Workspace struct {
|
||||
ID string `json:"id"`
|
||||
ConfigPath string `json:"configPath"`
|
||||
ID string `json:"id,omitempty"`
|
||||
ConfigPath string `json:"configPath,omitempty"`
|
||||
}
|
||||
|
Reference in New Issue
Block a user