diff --git a/main.go b/main.go index 49f1b73..6704163 100644 --- a/main.go +++ b/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) diff --git a/types.go b/types.go index e0dc286..774b805 100644 --- a/types.go +++ b/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"` }