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

Internal improvements #16

Merged
merged 7 commits into from
Apr 7, 2021
Merged

Internal improvements #16

merged 7 commits into from
Apr 7, 2021

Conversation

adrg
Copy link
Owner

@adrg adrg commented Apr 4, 2021

On some versions of Windows, os.Stat returns an error for Unix sockets. Also, seems like on all Windows versions, it returns an error for symbolic links to directories.

@codecov
Copy link

codecov bot commented Apr 4, 2021

Codecov Report

Merging #16 (4e50b36) into master (ecf63cb) will increase coverage by 0.15%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #16      +/-   ##
==========================================
+ Coverage   92.63%   92.78%   +0.15%     
==========================================
  Files           6        8       +2     
  Lines         190      194       +4     
==========================================
+ Hits          176      180       +4     
  Misses         13       13              
  Partials        1        1              
Impacted Files Coverage Δ
paths_unix.go 100.00% <ø> (ø)
stat.go 100.00% <100.00%> (ø)
stat_windows.go 100.00% <100.00%> (ø)
utils.go 75.43% <100.00%> (-0.84%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ecf63cb...4e50b36. Read the comment docs.

Copy link

@djdv djdv left a comment

Choose a reason for hiding this comment

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

I tested 4e50b36 with the previously posted code and it seems to be working now.
xdg.RuntimeFile gives me a path to use within %LOCALAPPDATA%, and later finds the socket that is created within it.

The tests also seem to be passing:
> go test -v
=== RUN   TestDefaultBaseDirs
    xdg_test.go:22: Home: C:\Users\Dominic Della Valle
    xdg_test.go:41: XDG_DATA_HOME: C:\Users\Dominic Della Valle\AppData\Local
    xdg_test.go:41: XDG_DATA_DIRS: [C:\Users\Dominic Della Valle\AppData\Roaming C:\Users\Dominic Della Valle\ProgramData]
    xdg_test.go:41: XDG_CONFIG_HOME: C:\Users\Dominic Della Valle\AppData\Local
    xdg_test.go:41: XDG_CONFIG_DIRS: [C:\Users\Dominic Della Valle\ProgramData]
    xdg_test.go:41: XDG_CACHE_HOME: C:\Users\Dominic Della Valle\AppData\Local\cache
    xdg_test.go:41: XDG_RUNTIME_DIR: C:\Users\Dominic Della Valle\AppData\Local
    xdg_test.go:41: XDG_STATE_HOME: C:\Users\Dominic Della Valle\AppData\Local
    xdg_test.go:41: XDG_APPLICATION_DIRS: [C:\Users\Dominic Della Valle\AppData\Roaming\Microsoft\Windows\Start Menu\Programs]
    xdg_test.go:41: XDG_FONT_DIRS: [C:\Windows\Fonts C:\Users\Dominic Della Valle\AppData\Local\Microsoft\Windows\Fonts]
    xdg_test.go:22: Home: C:\Users\Dominic Della Valle
    xdg_test.go:41: XDG_DATA_HOME: C:\Users\Dominic Della Valle\AppData\Local
    xdg_test.go:41: XDG_DATA_DIRS: [C:\Users\Dominic Della Valle\AppData\Roaming C:\Users\Dominic Della Valle\ProgramData]
    xdg_test.go:41: XDG_CONFIG_HOME: C:\Users\Dominic Della Valle\AppData\Local
    xdg_test.go:41: XDG_CONFIG_DIRS: [C:\Users\Dominic Della Valle\ProgramData]
    xdg_test.go:41: XDG_CACHE_HOME: C:\Users\Dominic Della Valle\AppData\Local\cache
    xdg_test.go:41: XDG_RUNTIME_DIR: C:\Users\Dominic Della Valle\AppData\Local
    xdg_test.go:41: XDG_STATE_HOME: C:\Users\Dominic Della Valle\AppData\Local
    xdg_test.go:41: XDG_APPLICATION_DIRS: [C:\Users\Dominic Della Valle\AppData\Roaming\Microsoft\Windows\Start Menu\Programs]
    xdg_test.go:41: XDG_FONT_DIRS: [C:\Windows\Fonts C:\Users\Dominic Della Valle\AppData\Local\Microsoft\Windows\Fonts]
    xdg_test.go:22: Home: C:\Users\Dominic Della Valle
    xdg_test.go:41: XDG_DATA_HOME: C:\Users\Dominic Della Valle\AppData\Local
    xdg_test.go:41: XDG_DATA_DIRS: [C:\Users\Dominic Della Valle\AppData\Roaming C:\Users\Dominic Della Valle]
    xdg_test.go:41: XDG_CONFIG_HOME: C:\Users\Dominic Della Valle\AppData\Local
    xdg_test.go:41: XDG_CONFIG_DIRS: [C:\Users\Dominic Della Valle]
    xdg_test.go:41: XDG_CACHE_HOME: C:\Users\Dominic Della Valle\AppData\Local\cache
    xdg_test.go:41: XDG_RUNTIME_DIR: C:\Users\Dominic Della Valle\AppData\Local
    xdg_test.go:41: XDG_STATE_HOME: C:\Users\Dominic Della Valle\AppData\Local
    xdg_test.go:41: XDG_APPLICATION_DIRS: [C:\Users\Dominic Della Valle\AppData\Roaming\Microsoft\Windows\Start Menu\Programs]
    xdg_test.go:41: XDG_FONT_DIRS: [C:\Users\Dominic Della Valle\Fonts C:\Users\Dominic Della Valle\AppData\Local\Microsoft\Windows\Fonts]
--- PASS: TestDefaultBaseDirs (0.00s)
=== RUN   TestCustomBaseDirs
    xdg_test.go:22: Home: C:\Users\Dominic Della Valle
    xdg_test.go:41: XDG_DATA_HOME: C:\Users\Dominic Della Valle\Appdata\Local\Data
    xdg_test.go:41: XDG_DATA_DIRS: [C:\Users\Dominic Della Valle\Appdata\Local\Data C:\Users\Dominic Della Valle\Appdata\Data]
    xdg_test.go:41: XDG_CONFIG_HOME: C:\Users\Dominic Della Valle\Appdata\Local\Config
    xdg_test.go:41: XDG_CONFIG_DIRS: [C:\Users\Dominic Della Valle\Appdata\Local\Config C:\Users\Dominic Della Valle\Appdata\Config]
    xdg_test.go:41: XDG_CACHE_HOME: C:\Users\Dominic Della Valle\ProgramData\Cache
    xdg_test.go:41: XDG_RUNTIME_DIR: C:\Users\Dominic Della Valle\ProgramData\Runtime
    xdg_test.go:41: XDG_STATE_HOME: C:\Users\Dominic Della Valle\ProgramData\State
--- PASS: TestCustomBaseDirs (0.00s)
=== RUN   TestDefaultUserDirs
    xdg_test.go:22: Home: C:\Users\Dominic Della Valle
    xdg_test.go:41: XDG_DESKTOP_DIR: C:\Users\Dominic Della Valle\Desktop
    xdg_test.go:41: XDG_DOWNLOAD_DIR: C:\Users\Dominic Della Valle\Downloads
    xdg_test.go:41: XDG_DOCUMENTS_DIR: C:\Users\Dominic Della Valle\Documents
    xdg_test.go:41: XDG_MUSIC_DIR: C:\Users\Dominic Della Valle\Music
    xdg_test.go:41: XDG_PICTURES_DIR: C:\Users\Dominic Della Valle\Pictures
    xdg_test.go:41: XDG_VIDEOS_DIR: C:\Users\Dominic Della Valle\Videos
    xdg_test.go:41: XDG_TEMPLATES_DIR: C:\Users\Dominic Della Valle\Templates
    xdg_test.go:41: XDG_PUBLICSHARE_DIR: C:\Users\Dominic Della Valle\Public
    xdg_test.go:22: Home: C:\Users\Dominic Della Valle
    xdg_test.go:41: XDG_DESKTOP_DIR: C:\Users\Dominic Della Valle\Desktop
    xdg_test.go:41: XDG_DOWNLOAD_DIR: C:\Users\Dominic Della Valle\Downloads
    xdg_test.go:41: XDG_DOCUMENTS_DIR: C:\Users\Dominic Della Valle\Documents
    xdg_test.go:41: XDG_MUSIC_DIR: C:\Users\Dominic Della Valle\Music
    xdg_test.go:41: XDG_PICTURES_DIR: C:\Users\Dominic Della Valle\Pictures
    xdg_test.go:41: XDG_VIDEOS_DIR: C:\Users\Dominic Della Valle\Videos
    xdg_test.go:41: XDG_TEMPLATES_DIR: C:\Users\Dominic Della Valle\Templates
    xdg_test.go:41: XDG_PUBLICSHARE_DIR: C:\Users\Dominic Della Valle\Public
--- PASS: TestDefaultUserDirs (0.00s)
=== RUN   TestCustomUserDirs
    xdg_test.go:22: Home: C:\Users\Dominic Della Valle
    xdg_test.go:41: XDG_DESKTOP_DIR: C:\Users\Dominic Della Valle\Files\Desktop
    xdg_test.go:41: XDG_DOWNLOAD_DIR: C:\Users\Dominic Della Valle\Files\Downloads
    xdg_test.go:41: XDG_DOCUMENTS_DIR: C:\Users\Dominic Della Valle\Files\Documents
    xdg_test.go:41: XDG_MUSIC_DIR: C:\Users\Dominic Della Valle\Files\Music
    xdg_test.go:41: XDG_PICTURES_DIR: C:\Users\Dominic Della Valle\Files\Pictures
    xdg_test.go:41: XDG_VIDEOS_DIR: C:\Users\Dominic Della Valle\Files\Videos
    xdg_test.go:41: XDG_TEMPLATES_DIR: C:\Users\Dominic Della Valle\Files\Templates
    xdg_test.go:41: XDG_PUBLICSHARE_DIR: C:\Users\Dominic Della Valle\Files\Public
--- PASS: TestCustomUserDirs (0.00s)
=== RUN   TestBaseDirFuncs
--- PASS: TestBaseDirFuncs (0.02s)
PASS
ok      github.com/adrg/xdg     0.060s

@adrg adrg merged commit cd7c09a into master Apr 7, 2021
@adrg
Copy link
Owner Author

adrg commented Apr 7, 2021

@djdv Thank you for all the help. I'll release a new version shortly so you can use it in your project.

@adrg adrg deleted the internal-improvements branch April 7, 2021 17:32
@adrg
Copy link
Owner Author

adrg commented Apr 7, 2021

@djdv Just released v.0.3.3. I also added you to the contributors list in README.md. Thanks again.

@djdv
Copy link

djdv commented Apr 7, 2021

Thanks for the support! Happy to help :^)

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