Skip to content

Commit

Permalink
fix(GetStateFolder): put files in specific state folder
Browse files Browse the repository at this point in the history
  • Loading branch information
rxri committed Feb 3, 2025
1 parent d22962f commit 7cb5498
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ var (
spicetifyFolder = utils.GetSpicetifyFolder()
rawFolder, themedFolder = getExtractFolder()
backupFolder = utils.GetStateFolder("Backup")
userThemesFolder = utils.GetUserFolder("Themes")
userThemesFolder = utils.GetSubFolder(spicetifyFolder, "Themes")
quiet bool
isAppX = false
spotifyPath string
Expand Down
13 changes: 7 additions & 6 deletions src/utils/path-utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,20 +92,21 @@ func GetStateFolder(name string) string {

result = filepath.Join(parent, "spicetify")
}
return result

return GetSubFolder(result, name)
}

// getUserFolder checks if folder `name` is available in spicetifyFolder,
// GetSubFolder checks if folder `name` is available in specified folder,
// else creates then returns the path.
func GetUserFolder(name string) string {
dir := filepath.Join(GetSpicetifyFolder(), name)
func GetSubFolder(folder string, name string) string {
dir := filepath.Join(folder, name)
CheckExistAndCreate(dir)

return dir
}

var userAppsFolder = GetUserFolder("CustomApps")
var userExtensionsFolder = GetUserFolder("Extensions")
var userAppsFolder = GetSubFolder(GetSpicetifyFolder(), "CustomApps")
var userExtensionsFolder = GetSubFolder(GetSpicetifyFolder(), "Extensions")

func GetCustomAppSubfolderPath(folderPath string) string {
entries, err := os.ReadDir(folderPath)
Expand Down

0 comments on commit 7cb5498

Please sign in to comment.