-
-
Notifications
You must be signed in to change notification settings - Fork 29
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
DataDirs no longer used #54
Comments
Hi @gwillem
Can you please explain the confusion part? The
The commit you are referencing is before the first ever release/tag of the library. I don't do breaking changes between minor releases of the application unless I absolutely have to, in which case, I mention it in the release notes. However, in this case, you were not even using a released version. Also, the commit you are referencing does not remove the use of It is unfortunate that your app stopped working after the upgrade and while I don't know the exact reason for that, again, you were using an unreleased version of the library. Also, you opened an issue which implies that I made a breaking change (which I did not) and your proposed solution is that I make a real breaking change, by removing This is not a real issue and needs to be closed. |
For the record, I am not accusing anyone, I am only grateful that you made this package, thanks for that!
Commit 1be1d4f1c3bb00cccaa31a0a8044278c1c0d1cc6 changes from using DataDirs to using baseDirs.dataFile (which does not use DataDirs). So, AFAICT, DataDirs is no longer used internally, only exported. func DataFile(name string) (string, error) {
- return createPath(name, DataDirs)
+ return baseDirs.dataFile(relPath)
} |
Maybe I misunderstand? func Test_xdgDataDir(t *testing.T) {
xdg.DataDirs = []string{"/tmp"}
xdg.DataHome = "/nonexistent_location"
path, err := xdg.DataFile("test.txt")
assert.NoError(t, err)
assert.Equal(t, "/tmp/test.txt", path)
// /Users/willem/Library/Application Support/test.txt
} |
That is what I'm saying: This is what DataDirs = xdgPaths("DATA_DIRS", DataHome,
[]string{"/usr/local/share", "/usr/share"}) This is func DataFile(name string) (string, error) {
return createPath(name, DataDirs)
} In the "new" version, DataDirs = baseDirs.Data which is: baseDirs.Data = xdgPaths(envDataDirs, "/usr/local/share", "/usr/share") This is
which is: func (bd baseDirectories) dataFile(relPath string) (string, error) {
return createPath(relPath, append([]string{bd.DataHome}, bd.Data...))
} In both versions, |
Oh, I see now. Your application changes Why do you want to change If you really want to change them, although you should not need to, you can do something like: os.Setenv("XDG_DATA_HOME", "/nonexistent_location")
os.Setenv("XDG_DATA_DIRS", "/tmp")
xdg.Reload()
path, err := xdg.DataFile("test.txt") |
Thanks for checking!
To run unit tests.. Setting the OS envs works indeed, it just took me a while to figure that out :) |
Sure, no problem.
Ah, ok. You were changing them in unit tests. That's fair enough. |
I was upgrading today from
v0.0.0-20190319220657-88e5137d2444
tov0.4.0
and my app broke, becauseDataDirs
is still present but doesn't seem to be used anymore (removed here: 1be1d4f#diff-5c0868fc869fb66c2b33ba837118f18c43f5002d0a3f8b9e11aceabe703d4b86L98)I suggest dropping it altogether to prevent further confusion.
The text was updated successfully, but these errors were encountered: