Skip to content

fix: fix incorrect credentials path, create common config logic - #231

Closed
amoeba wants to merge 1 commit into
columnar-tech:mainfrom
amoeba:fix/dbc-config-locations
Closed

amoeba wants to merge 1 commit into
columnar-tech:mainfrom
amoeba:fix/dbc-config-locations

Conversation

@amoeba

@amoeba amoeba commented Dec 12, 2025

Copy link
Copy Markdown
Member

Closes #230

@amoeba
amoeba requested a review from zeroshade December 12, 2025 22:06
Comment thread internal/dirs.go
Comment on lines +13 to +22
userdir, err := os.UserConfigDir()
if err != nil {
return "", fmt.Errorf("failed to get dbc configuration directory: %v", err)
}

orgDirName := "columnar"
if runtime.GOOS == "windows" || runtime.GOOS == "darwin" {
orgDirName = "Columnar"
}
dbcDirName := "dbc"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

but you were the one who said I should use XDG_DATA_HOME if it exists.... lol

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Oh right. 🤦 This still fixes the original issue that was reported. Let me think about it and I'll tweak this so it uses XDG_DATA_DIR on Linuxes.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Which would make this:

  • macOS + Windows: os.UserConfigDir()
  • Linux: check XDG_DATA_DIR, fallback to os.UserConfigDir()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

it should be XDG_DATA_HOME, there is no XDG_DATA_DIR there is XDG_DATA_DIRS which is a list of paths

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

and we should still check XDG_DATA_HOME on macOS too. According to Apple's docs, the equivalent for XDG_DATA_HOME on macOS is ~/Library/

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Oh, that last bit I didn't know.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Maybe my idea was bad, I'll think about it more when I'm back.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

yea, that's why it was using the logic I laid out. which was separate from the XDG_CONFIG_HOME (os.UserConfigDir) heh

@zeroshade

Copy link
Copy Markdown
Member

Did we come to a consensus on this?

@amoeba

amoeba commented Jan 11, 2026

Copy link
Copy Markdown
Member Author

Did we come to a consensus on this?

I wasn't able to find anything solid to go off of. The only thing that recommends a dir like ~/Library/dbc is a random FAQ on Java: https://developer.apple.com/library/archive/qa/qa1170/_index.html. But it makes a point that aligns with how XDG does things: it's good practice to separate config from data. Is this the ref you are referring to when you say,

According to Apple's docs, the equivalent for XDG_DATA_HOME on macOS is ~/Library/...

I think I'm okay with closing this PR unmerged and keeping the current behavior.

@amoeba

amoeba commented Jan 12, 2026

Copy link
Copy Markdown
Member Author

I just created a PR with regression tests for the current credentials path behavior: #247.

@ianmcook

Copy link
Copy Markdown
Member

After more discussion in #230, I think the decision is:

UUIDs, other config, etc. go under:

  • macOS: $HOME/Library/Application Support
  • Linux: $XDG_CONFIG_HOME or $HOME/.config
  • Windows: %APPDATA% (i.e. C:\Users\<Username>\AppData\Roaming)

Credentials go under:

  • macOS: $HOME/Library/Application Support (same as above)
  • Linux: $XDG_DATA_HOME or $HOME/.local/share
  • Windows: %LOCALAPPDATA% (i.e. C:\Users\<Username>\AppData\Local)

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.

Rationalize locations where dbc configs are stored

3 participants