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

[Feature Request] Follow XDG Base Directory Specification on Linux #158

Open
sukanka opened this issue May 22, 2022 · 0 comments
Open

[Feature Request] Follow XDG Base Directory Specification on Linux #158

sukanka opened this issue May 22, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@sukanka
Copy link

sukanka commented May 22, 2022

background

Currently, yank-note put all user files in ~/yank-note, but it would be better to follow the XDG specification, see XDG Base Directory Specification.

There are few files in ~/yank-note, and they can be easily classified.

➜  yank-note ls     
config.json  extensions  histories  pandoc-reference.docx  plugins  themes

config.json should go to $XDG_CONFIG_HOME/yank-note (defaults to $HOME/.config/yank-note when the environment variable $XDG_CONFIG_HOME is undefined.)

And extensions pandoc-reference.docx plugins themes should go to $XDG_DATA_HOME/yank-note, which defaults
to $HOME/.local/share/yank-note,

Finally, histories should go to $XDG_CACHE_HOME/yank-note, which defaults to $HOME/.cache/yank-note.

suggested solution

Only the following lines need to be changed. You can follow https://github.com/rivy/js.xdg-portable,

yn/src/main/constant.ts

Lines 11 to 20 in 4cfd1ac

export const HOME_DIR = homedir
export const USER_DIR = path.resolve((yargs.argv['data-dir'] as any) || path.join(homedir, APP_NAME))
export const CONFIG_FILE = path.join(USER_DIR, 'config.json')
export const STATIC_DIR = path.join(__dirname, '../renderer')
export const HELP_DIR = path.join(__dirname, '../../help')
export const ASSETS_DIR = path.join(__dirname, 'assets')
export const HISTORY_DIR = path.join(USER_DIR, './histories')
export const USER_PLUGIN_DIR = path.join(USER_DIR, './plugins')
export const USER_THEME_DIR = path.join(USER_DIR, './themes')
export const USER_EXTENSION_DIR = path.join(USER_DIR, './extensions')

const docxTplPath = path.join(USER_DIR, PANDOC_REFERENCE_FILE)

@purocean purocean added the enhancement New feature or request label May 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants