wbond / package_control

The Sublime Text package manager
https://packagecontrol.io
4.8k stars 814 forks source link

“Create Package File”: fails on Linux non‑English environment due to Desktop folder name #1038

Closed Hibou57 closed 10 months ago

Hibou57 commented 8 years ago

This is a platform dependent issue. The report comes with an hint to solve it.

I wanted to check something, generating a package file locally. I'm running Ubuntu and got this error:

An error occurred creating the package file <name>.sublime-package in /home/<user>/Desktop.

[Errno 2] No such file or directory: '/home/<user>/Desktop/<name>.sublime-package'

The Desktop folder is Bureau for me (French locales). Seems Package Control assumes an English environment or is not aware folders names change depending on the locales.

Within FreeDesktop environment, there is way to determine these folders names: read, or source from a shell, the file $HOME/.config/user-dirs.dirs.

Ex. for me it contains:

# This file is written by xdg-user-dirs-update
# If you want to change or add directories, just edit the line you're
# interested in. All local changes will be retained on the next run
# Format is XDG_xxx_DIR="$HOME/yyy", where yyy is a shell-escaped
# homedir-relative path, or XDG_xxx_DIR="/yyy", where /yyy is an
# absolute path. No other format is supported.
# 
XDG_DESKTOP_DIR="$HOME/Bureau"
XDG_DOWNLOAD_DIR="$HOME/Téléchargements"
XDG_TEMPLATES_DIR="$HOME/Modèles"
XDG_PUBLICSHARE_DIR="$HOME/Public"
XDG_DOCUMENTS_DIR="$HOME/Documents"
XDG_MUSIC_DIR="$HOME/Musique"
XDG_PICTURES_DIR="$HOME/Images"
XDG_VIDEOS_DIR="$HOME/Vidéos"

Either sourcing it from a shell and then reading the XDG_DESKTOP_DIR environment variable or parsing it and substituting the environment variables found in the values, allows to get the locale name of the Desktop folder.

FichteFoll commented 8 years ago

What does executing sublime.packages_path() in the console yield? irrelevant

wbond commented 8 years ago

What version of Sublime Text, and what are your environment variables for your locale?

wbond commented 8 years ago

Sorry, I thought this was an encoding issue. I see what you mean now.

You can set https://packagecontrol.io/docs/settings#setting-package_destination.