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

Use standard directories on Unix and Windows #21

Merged
merged 1 commit into from
Jun 15, 2015

Conversation

odensc
Copy link
Contributor

@odensc odensc commented Jun 10, 2015

Not sure what the coding style is, so if I made a mistake please tell me.

@odensc odensc mentioned this pull request Jun 10, 2015
@odensc
Copy link
Contributor Author

odensc commented Jun 10, 2015

Now that I think about it, the tests might need to be changed to account for this too.

EDIT: Yep, errored.

@odensc odensc force-pushed the patch-1 branch 2 times, most recently from f847832 to 629e438 Compare June 10, 2015 21:40
@odensc
Copy link
Contributor Author

odensc commented Jun 10, 2015

Fixed problems and rebased, tests should finish now.

@@ -27,6 +27,9 @@ function fail (err) {

function openConfig (cb) {
var userHome = require('user-home');
if (process.platform === 'linux' && userHome) {
userHome += '/.cache';
Copy link

Choose a reason for hiding this comment

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

I think you should scope this by if the platform is windows or not. OSX has a standard ~/.cache path as well. Also, if windows has a similar path, we should use it (and use path.join here as well).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed.

@tkellen
Copy link

tkellen commented Jun 10, 2015

Before we merge something like this I just want to check with @sindresorhus to see if he wants to support this directly in the user-home module.

@odensc
Copy link
Contributor Author

odensc commented Jun 10, 2015

That would probably be best fit for another module, isn't user-home only for getting the user home? It doesn't do anything else.

@tkellen
Copy link

tkellen commented Jun 10, 2015

Sure, but it could expose a second property? If @sindresorhus doesn't want
to add this maybe you could cut a module that builds off his and upstream
it here?
On Jun 10, 2015 5:57 PM, "Oden" notifications@github.com wrote:

That would probably be best fit for another module, isn't user-home only
for getting the user home? It doesn't do anything else.


Reply to this email directly or view it on GitHub
#21 (comment).

@sindresorhus
Copy link

I already have a module for this:
https://github.com/sindresorhus/xdg-basedir#cache

@odensc
Copy link
Contributor Author

odensc commented Jun 11, 2015

I feel like adding two modules just to userHome || os.tmpdir() and path.join(userHome, '.cache') is a bit overkill.

@sindresorhus
Copy link

Yeah, never mind the last suggestion, it's moot if you decide to use xdg-basedir.

@tkellen
Copy link

tkellen commented Jun 11, 2015

@TheSBros I did some digging about Windows, the standard cache directory would be path.join(userHome, 'AppData', 'Local'). Since xdg-basedir doesn't take this into account, I'm 👍 to integrating it directly. Happy to merge once we have windows equally accounted for!

@odensc odensc changed the title Use standard directory .cache on Linux Use standard directories on Unix and Windows Jun 11, 2015
@odensc
Copy link
Contributor Author

odensc commented Jun 11, 2015

Alright, done.

@tkellen
Copy link

tkellen commented Jun 15, 2015

thanks @TheSBros!

tkellen pushed a commit that referenced this pull request Jun 15, 2015
Use standard directories on Unix and Windows
@tkellen tkellen merged commit d3905fe into gulpjs:master Jun 15, 2015
@tkellen
Copy link

tkellen commented Jun 15, 2015

published as 2.0.6

@alchemicalhydra
Copy link

Hmm, why was this reverted?

I finally tracked down what was creating the annoying ".v8flags.foo.bar.json" in my home directory to this package, saw that the issue was already solved by this PR in 2.0.6 (by nicely sticking it in the XDG cache dir) ... and then undone in 2.0.7. I can't figure out why from reading the commits and issues.

@odensc
Copy link
Contributor Author

odensc commented Oct 8, 2015

Seems it has to do with this. Don't know why it was completely reverted rather than just making it create the folder.

@phated
Copy link
Member

phated commented Oct 8, 2015

Yep, regressions abound were introduced. It will probably be re-added when #29 is fixed.

@tkellen
Copy link

tkellen commented Oct 13, 2015

@TheSBros it was completely reverted because I was in the middle of a consulting project when this change blew up. I'd love a PR that fixes the underlying problem so we can restore this functionality.

@Siilwyn
Copy link
Contributor

Siilwyn commented May 6, 2017

Just went through the same hassle @tomxtobin, finally found the package doing this. ^^

So maybe #29 is fixed by #31 and then we could use standard directories! 🙌
Also I'd use the env-paths module instead of writing the logic.

@tkellen
Copy link

tkellen commented May 6, 2017

I'd happily take a PR for this if you're willing to be the front line for the inevitable fallout.

There are a fair few projects which depend on this:
https://www.npmjs.com/browse/depended/v8flags

@Siilwyn
Copy link
Contributor

Siilwyn commented May 6, 2017

I think I would be willing...
Especially if a major version bump is allowed. :)

@phated
Copy link
Member

phated commented May 6, 2017

No sindre modules. Sorry.

@Siilwyn
Copy link
Contributor

Siilwyn commented May 6, 2017

@phated are you serious or just joking?

@phated
Copy link
Member

phated commented May 6, 2017

Serious, I have a bunch of examples why not to but the basic rule is "don't"

@Siilwyn
Copy link
Contributor

Siilwyn commented May 6, 2017

Hmm that's a bummer, I used this module several times and helped with fixing a bug so implementing the logic another time here seems in vain. Since the whole module is only about 60 lines of code could you give it a chance/look?

@alextes
Copy link

alextes commented May 6, 2017

@phated do you happen to have them written down somewhere?

@phated
Copy link
Member

phated commented May 6, 2017

Locking this. It's not the place to discuss this.

@gulpjs gulpjs locked and limited conversation to collaborators May 6, 2017
@tkellen
Copy link

tkellen commented May 6, 2017

@phated I think you're being a bit unreasonable here. If this functionality is something these folks want to add and they are willing to bear the responsibility of the impact, I see no reason to block them. @Siilwyn, please go ahead with your PR. If @phated is that hard-line about Sindre's modules, just inline the code and tests, the world will not explode because of the duplication.

@phated
Copy link
Member

phated commented May 6, 2017

One of the reasons to not use his modules is that he is systematically dropping node 0.10 support from his modules (in some cases just to use an arrow function that makes no sense). All the gulp dependency tree is going to support node 0.10 for quite some time so we won't be depending on his modules.

If you'd like to rewrite the code and give proper attribution to the original author or find a similar module, feel free to submit a PR.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants