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

Drop uuid and just use native mkdtemp #122

Merged
merged 4 commits into from
Mar 10, 2021
Merged

Drop uuid and just use native mkdtemp #122

merged 4 commits into from
Mar 10, 2021

Conversation

fregante
Copy link
Contributor

@fregante fregante commented Mar 9, 2021

Node has had a way to create temporary directories since v5: https://nodejs.org/api/fs.html#fs_fs_mkdtempsync_prefix_options

Sorry for the noise in this PR. It took me a while to figure out why it was refusing to work on Travis

@fregante fregante marked this pull request as draft March 10, 2021 00:45
@fregante fregante changed the title Drop uuid and just use native mktemp Drop uuid and just use native mkdtemp Mar 10, 2021
@@ -603,7 +602,7 @@ FirefoxProfile.prototype._installExtension = function (addon, cb) {
self = this;

if (addon.slice(-4) === '.xpi') {
tmpDir = this._createTempFolder(addon.split(path.sep).slice(-1));
tmpDir = this._createTempFolder(addon.split(path.sep).pop());
Copy link
Contributor Author

Choose a reason for hiding this comment

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

slice returned an array. It worked before because _createTempFolder was concatenating this with +

@@ -152,7 +151,7 @@ function FirefoxProfile(options) {
this.profileDir = opts.destinationDirectory || this._createTempFolder();
} else {
// create copy
var tmpDir = opts.destinationDirectory || this._createTempFolder('-copy');
var tmpDir = opts.destinationDirectory || this._createTempFolder('copy-');
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I had to change this to be a prefix instead of suffix due to how the API works.

This path is meant to be temporary and hidden from the user, so I'm guessing it was implemented only to improve debugging but isn't fundamental.

Copy link
Owner

Choose a reason for hiding this comment

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

The idea here is to not alter an existing profile directory (if provided in options.profileDir).

@fregante fregante marked this pull request as ready for review March 10, 2021 01:51
@saadtazi
Copy link
Owner

Thank you again @fregante ! It's really appreciated.

I took the liberty to fix the conflicts in another PR, completely based on your branch: #124. Feel free to review my PR (lol) or fix the conflicts in yours (whichever you prefer).

@saadtazi saadtazi merged commit 94b7279 into saadtazi:master Mar 10, 2021
@fregante fregante deleted the drop-uuid branch March 10, 2021 17:40
@saadtazi
Copy link
Owner

@fregante I released v4.2.0 earlier today 🎉 !

@fregante
Copy link
Contributor Author

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