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

Setting --user-data-dir to custom location still causes AppData folder to be created #6328

Open
starsoccer opened this issue Dec 14, 2017 · 16 comments
Assignees

Comments

@starsoccer
Copy link

NWJS Version : 0.27.1
Operating System : Windows 10

Expected behavior

If user-data-dir is set to a custom location, no folder should be created in AppData\Local%appname%

Actual behavior

Empty folders are created in AppData\Local%appname%. Specifically a User Data and a User Data\CrashPad folder are created

How to reproduce

  1. Create a simple app with NWJS and then set the --user-data-dir to a custom location.
  2. Run the app
  3. Close the app
  4. Check AppData\Local%appname% to see if a folder exists
@Christywl
Copy link
Contributor

I can reproduce this issue on Linux/Windows with nwjs-sdk-v0.27.1.

@keenghost
Copy link

keenghost commented Jun 29, 2018

Is this bug fixed yet? nw.js version 0.31.4 still has this problem, that's annoying.
By the way, nw.exe --user-data-dir=%APPDATA%\myapp works well with cmd.exe, but "chromium-args":"--user-data-dir=%APPDATA%\\myapp" in the package.json didnt work.
It just creates a folder named %APPDATA% in the current directory but not converts to system path, is that a bug or I'm using it in a wrong way?

@rowenbuzz
Copy link

I would like to add a [Feature Request] to simply not write the app_name (where app_name is the name field value in the package.json) not only from the \Local\AppData location, but do not write it anywhere if possible.

Here is a thread on the Google Group explaining more details with Roger:
https://groups.google.com/forum/#!topic/nwjs-general/bQdFZEVXcBs

@zkrige
Copy link

zkrige commented May 16, 2019

Is this bug fixed yet? nw.js version 0.31.4 still has this problem, that's annoying.
By the way, nw.exe --user-data-dir=%APPDATA%\myapp works well with cmd.exe, but "chromium-args":"--user-data-dir=%APPDATA%\\myapp" in the package.json didnt work.
It just creates a folder named %APPDATA% in the current directory but not converts to system path, is that a bug or I'm using it in a wrong way?

I'm having the same issue. The environment variables aren't being expanded, but are being used as literals. nwjs:0.32.4

@mikekilburn
Copy link
Contributor

@rogerwang is there a plan to fix this? Or at least offer an nwjs api/setting to use %APPDATA% rather than %LOCALAPPDATA% which is the default now. This bug makes it impossible to have the user-data-dir in each users roaming folder.

@f3l1x
Copy link

f3l1x commented May 7, 2020

Version: 0.45.5

{
  "name": "test",
  "version": "0.0.1",
  "main": "app.js"
  "chromium-args": [
    "--user-data-dir=./data"
  ]
}

Does not work for me.

@mikekilburn
Copy link
Contributor

@rogerwang here is a pull request that fixes this issue. #7477 . At Mitel we use nwjs for our UC client and need to have local storage in the roaming folder (%APPDATA%) rather than %LOCALAPPDATA%. Please have a look.

@TheRealDannyyy
Copy link

Has this issue been fixed? From the PR it looks like it's all done.

@TheRealDannyyy
Copy link

TheRealDannyyy commented Jul 1, 2020

I just tested this out and it's still broken.
@rogerwang This is a P3 issue, would you mind fixing it if you got the time to?

My steps to reproduce (sample: package.zip):

  1. Run blank app (includes "--user-data-dir=test")
  2. Close running app
  3. Notice "test" folder being created as expected
  4. Notice "UserdirTEST" folder also being created, despite using custom path
    [C:\Users\YOURNAMEHERE\AppData\Local\UserdirTEST]

@mkilburn60
Copy link

@TheRealDannyyy yes its working really well ;). Be careful to use single quotes to handle paths with spaces. Here is an example with single quotes in two places. "chromium-args": "--user-data-dir='%APPDATA%'\TheProduct\'User Data'"

@TheRealDannyyy
Copy link

TheRealDannyyy commented Jul 1, 2020

@mkilburn60 Based on my test case it doesn't. It seems like crashpad is causing a userdir to be created inside the appdata folder.

@mkilburn60
Copy link

mkilburn60 commented Jul 1, 2020

@TheRealDannyyy note you two backslash for each of the path separators but this page removes one when it renders.

@mkilburn60
Copy link

@TheRealDannyyy thats true - crash dumps still go to the default.

@mkilburn60
Copy link

@TheRealDannyyy I'm guessing the same fix would need to be applied to --crash-dumps-dir

@mkilburn60
Copy link

@TheRealDannyyy the expansion is applied to the whole command line so try setting --crash-dumps-dir to %APPDATA%

@webstorybegin
Copy link

Hi guys, is the problem still not solved?
when installing our application, a folder like nw_817_813871837 (numbers may vary) is created in c:/Program Files, it is empty. If you turn off (close) the application this folder disappears. If you uninstall and reinstall the folder is not created. If you install another version of the application, the folder appears again. Sometimes it is not deleted after closing.
Windows defender reacts to all this. Very much need help, in our application windows defender plays a big role

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

No branches or pull requests