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

Development mode inside profile folder #15

Closed
Madis0 opened this issue Aug 6, 2018 · 12 comments
Closed

Development mode inside profile folder #15

Madis0 opened this issue Aug 6, 2018 · 12 comments

Comments

@Madis0
Copy link
Contributor

Madis0 commented Aug 6, 2018

Could I use a development mode folder inside the Fx profile folder? It would keep things consistent and contained.

Right now I get a "That didn't work... / Error: Can't create file..." popup, followed by the typical restart prompt (and no new style after the restart).


To give more information:

  • I created a folder called dev
  • Used the full path in settings (not relative to anything)
  • reStyle - DEV 0.4.1b20
  • Nightly 63.0a1 (2018-08-04)
NiklasGollenstede added a commit that referenced this issue Aug 6, 2018
@NiklasGollenstede
Copy link
Owner

You mean like this?:
image

From a technical perspective I don't see why not. It's probably not a good ides to use the chrome folder in the Firefox profile because reStyle will then read and watch the same directory multiple times (but it should work).

I wouldn't do it, though. The profile dir is Firefox' to manage and Firefox could always decide to delete unexpected stuff in there.


Regarding your error, I just fixed an infinite recursion when changing between valid local folders, but that doesn't seem to be your problem.
I don't even see why reStyle would try to create files in your scenario ...
Please try this again with version 0.4.1b21!

@Madis0
Copy link
Contributor Author

Madis0 commented Aug 7, 2018

Wouldn't that also give reStyle an ability to create the folder on user's behalf?

I wouldn't do it, though. The profile dir is Firefox' to manage and Firefox could always decide to delete unexpected stuff in there.

The could be said for the whole chrome folder. Maybe reStyle could use just the userChrome.css and redirect other files to it's extension storage location?

Either way, I'll retry this later today.

@NiklasGollenstede
Copy link
Owner

Wouldn't that also give reStyle an ability to create the folder on user's behalf?

reStyle currently won't create the folder in the default location (as that wasn't the users choice), but if the path is changed and doesn't exist, it will now be created (regardless of where is is, as long as the user has access to that location). So now you can use local files without ever opening a file explorer (reStyle could already open the files in the native editor).

The could be said for the whole chrome folder.

Not quite. We are talking about the primary source location of styles here. You wouldn't want to loose that. No data would be lost if Firefox clears the chrome folder.

Maybe reStyle could use just the userChrome.css and redirect other files to it's extension storage location?

Not quite sure what you mean, but the userChrome.css is a way of applying styles, not a source to read styles from.

@Madis0
Copy link
Contributor Author

Madis0 commented Aug 7, 2018

Not quite sure what you mean, but the userChrome.css is a way of applying styles, not a source to read styles from.

I meant that reStyle could just create .../chrome/userChrome.css and everything else (active, inactive, development styles, xml and js files) can point to another location using @import.

Could you explain the reasoning for not using a folder in the extension files again? I did not quite get that.

@NiklasGollenstede
Copy link
Owner

I don't think that using @import would solve the problem with the restart requirement (I might want to try it, though).
And then I don't see much of a point in using @imports. It adds an additional layer of indirection and wouldn't work for remote styles (installed from URLs).


Could you explain the reasoning for not using a folder in the extension files again?

Sure. Here is why I wouldn't place the folder with the local styles inside Firefox' profile folder:

  • The profile folder is "owned" by Firefox. Nobody could complain if they delete files from there, and Firefox does this.
  • The local styles folder contains the primary copy of the local styles. If it gets deleted, there is a real potential for data loss.

Try linking something inside the extensions folder in the profile. Firefox will (at startup or shutdown, I don't recall) recursively delete everything through the symlink. Happened to me, deleted the sources of an entire extension. I had backups, but imagine how shocked I was at first.

Besides that, I don't think it belongs in there. The set of user styles you create is not associated with a single Firefox profile. If you want to use only a subset of your styles in a given profile, you can use the exclude filter.

The files automatically placed in the chrome folder only contain composed copies of other files. Loosing them wouldn't really matter.

That said, you are of cause free to put your local folder in the profile. It works, but be prepared for Firefox deleting it (if not now, then maybe later).

@Madis0
Copy link
Contributor Author

Madis0 commented Aug 7, 2018

Thanks for the explanation.
Tried the initial issue now on v0.4.1b23 and this time only got the file creation error. The feature works fine for a folder outside the profile though.


Reason for suggesting to use @imports is that then you could protect the online styles too, and let users easily import-export them (if they prefer file-based organization instead of one text file). I have yet to try your Browser Toolbox hack though, so I am not sure how well does it work.

Also, what is the plan for when an online resource goes down, but the style works fine?

@NiklasGollenstede
Copy link
Owner

got the file creation error

I still don't understand why reStyle would even try to create any files. You are talking about an error right after changing the path in the textbox I took the screenshot of above, right?

what is the plan for when an online resource goes down, but the style works fine?

Currently it will simply stay as it is and be loaded from an internal copy. Updates will obviously fail, which will cause a notification at the time of the auto update. There is currently no way to disable the update check for individual styles, and reStyle doesn't handle the updateURL metadata property at all (which should booth be changed).

that then you could protect the online styles too

As in, make sure they aren't lost should Firefox ever clear the chrome folder?
That is not a problem. reStyle keeps a list of URLs of installed styles in storage.sync and a cache of both the raw and the parsed styles themselves in storage.local. Firefox shouldn't ever clear those.
Also, you shouldn't see the chrome dir as a storage location, but rather as an API (programming interface) to apply styles (at least that is how I think it should be and how reStyle treats it).

@Madis0
Copy link
Contributor Author

Madis0 commented Aug 8, 2018

I still don't understand why reStyle would even try to create any files. You are talking about an error right after changing the path in the textbox I took the screenshot of above, right?

No, I just tried to create a style with the browser button after changing the path.

Also, you shouldn't see the chrome dir as a storage location, but rather as an API (programming interface) to apply styles

That sounds reasonable.

@NiklasGollenstede
Copy link
Owner

NiklasGollenstede commented Aug 8, 2018

Ok, that makes a lot more sense.
The error Can't create file "${path}" gets thrown if:

  • the file name doesn't end with .css
  • the file path contains any segment starting with a .
  • the file is already accessible (i.e. exists)

Are you using Linux, where the profile is in ~/.mozilla? That would explain the error.
I can probably just drop the 2nd condition.

@Madis0
Copy link
Contributor Author

Madis0 commented Aug 8, 2018

Are you using Linux, where the profile is in ~/.mozilla?

Yes.

Assuming you fixed the folder creation inside profile folders, and added an ability to create folders within reStyle itself (by path), I have now tried the original path again with v24. Here's the result:
image

@NiklasGollenstede
Copy link
Owner

That error gets thrown when the installation of a remote style fails (URL to .css file in the textbox + click on "Add style").

To create a new local style, use the "Create new style" button (which uses the information of the current tab to populate the template).

I admit that the placement of both buttons underneath the textbox may be misleading.

@Madis0
Copy link
Contributor Author

Madis0 commented Aug 9, 2018

Oops, I indeed did do that. Everything works fine now, inside profile or not so I guess it's time to close this issue.

@Madis0 Madis0 closed this as completed Aug 9, 2018
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

No branches or pull requests

2 participants