Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: change folder location for Backup and Extracted #3282

Merged
merged 8 commits into from
Feb 3, 2025

Conversation

UnaTried
Copy link
Contributor

This was requested on issue #3201, I don't know how to test this, so I don't know if it will work. It should in theory though!

P.S: I am not a go-er I just made those changes, did go build and there was no ouput, so I assumed it worked, since it was throwing error whenever there was one.

Linux only version

func GetStateFolder(name string) string {
	result, isAvailable := os.LookupEnv("SPICETIFY_STATE")
	defer func() { CheckExistAndCreate(result) }()
		
	if isAvailable && len(result) > 0 {
		return result
	}

	if runtime.GOOS == "linux" {
		parent, isAvailable := os.LookupEnv("XDG_STATE_HOME")

		if !isAvailable || len(parent) == 0 {
			parent = filepath.Join(os.Getenv("HOME"), ".local", "state")
			CheckExistAndCreate(parent)
		}

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

@UnaTried UnaTried changed the title Changing Folder location for folder Backup and Extracted refactor: Changing Folder location for folder Backup and Extracted Jan 26, 2025
@UnaTried UnaTried changed the title refactor: Changing Folder location for folder Backup and Extracted refactor: Changing Folder location for folder Backup and Extracted Jan 26, 2025
@UnaTried UnaTried changed the title refactor: Changing Folder location for folder Backup and Extracted refactor(#3201): Changing Folder location for folder Backup and Extracted Jan 26, 2025
@UnaTried UnaTried changed the title refactor(#3201): Changing Folder location for folder Backup and Extracted refactor(#3201): changing folder location for folder Backup and Extracted Jan 26, 2025
@UnaTried UnaTried changed the title refactor(#3201): changing folder location for folder Backup and Extracted refactor(#3201): changing folder location for folder Backup and Extracted Jan 26, 2025
@rxri rxri changed the title refactor(#3201): changing folder location for folder Backup and Extracted refactor: change folder location for Backup and Extracted Jan 31, 2025
Copy link
Member

@rxri rxri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it doesn't return anything when env variable is undefined & os isn't linux tho

@UnaTried
Copy link
Contributor Author

UnaTried commented Feb 1, 2025

As I said, I do not use go, I just tried to fix that issue mixing GetUserFolder and GetSpicetifyFolder to make GetStateFolder

@rxri
Copy link
Member

rxri commented Feb 1, 2025

Then revert your last commit you made?

@UnaTried
Copy link
Contributor Author

UnaTried commented Feb 2, 2025

Ok, I have reverted my commit @rxri

@UnaTried UnaTried requested a review from rxri February 2, 2025 15:08
@rxri rxri merged commit bc37b7c into spicetify:main Feb 3, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants