powerplatform-vscode icon indicating copy to clipboard operation
powerplatform-vscode copied to clipboard

PowerApps Cli creating a usersettings.json in the wrong path

Open jansonjc opened this issue 2 years ago • 5 comments

Describe the bug

The PowerApp Cli seems to be creating the usersetting.json in a wrong path. Instead of creating in user's Library folder, it seems to be creating in the application folder. This is happening in MacOS. The attached screenshot will help explain this better.

Version: 1.15.3+g79950a8

To Reproduce

  • Install Power Platform Tools for Visual Studio Code (Mac M1)
  • Execute any Cli commands
  • A new folder structure gets created inside the application folder instead of ~/Library

Screenshots

PowerApps-Cli-Folder-Issue

jansonjc avatar May 19 '22 10:05 jansonjc

@jansonjc oh, that's a bizarre bug, thanks for reporting it! I assume you're installing the pac CLI on your mac via the PP VSCode extension, right?

I wasn't able to repro it on my MBP when only using pac CLI (e.g. pac telemetry disable, then ... enable would force writing the usersettings file). But I can repro when building a PCF proj with our pcf-scripts npm package:

pac pcf init -ns dj  -n ctrl1 -t field -fw react -o ctrl1
cd ctrl1
npm i
npm run build

alas, there's now a usersettings file...

[14:59:47] ~/s/p/ctrl1 
davidjen@davidjen-mbp $ find . -name usersettings.json
./~/Library/Microsoft/PowerAppsCli/usersettings.json

I'm transferring this issue to our powerplatform-vscode issues tracker; internal bug we have for tracking: AB#2750719

CC: @landonarogers @tehcrashxor @swapnilbhalgat

davidjenni avatar Jun 09 '22 22:06 davidjenni

@davidjenni that's right. This happens when the pac CLI commands are run within the integrated terminal of vscode. I have a shell script that contains a number of CLI commands (select environment, solution export, unpack, import, etc...) It is quite possible that one of these commands is causing this issue. Since you are able to reproduce this with pcf command, I hope the powerplatform-vscode team will be able to address it. Let me know if you want me to try and figure out exactly which command(s) is causing this.

jansonjc avatar Jun 13 '22 15:06 jansonjc

I'm having the issue as well (macOS).

~~It seems like the tilde character returned form getAppDataPath() isn't resolving to the home directory as expected.~~

cathalnoonan avatar Aug 17 '22 18:08 cathalnoonan

Any updates on this issue? Can confirm that if I change src/client/telemetry/appdata.ts:13 to

return `${process.env.HOME}/Library/`

I don't get an extra directory structure in the local directory when running PAC commands from VS Code. Not sure why #cathalnoonan marked out their assertion about the getAppDataPath() method as that does seem to be the culprit.

mccheesy avatar Jan 19 '24 03:01 mccheesy

I've forgotten the exact reason for crossing that out.

I think the folder was still created when using the pac cli directly (without the vscode extension).

cathalnoonan avatar Jan 26 '24 18:01 cathalnoonan