shiipou / clone-project-manager

A simple script to help me to keep my projects clean when I clone it
MIT License
1 stars 1 forks source link

[BUG] projects.json path is not correct on WSL #10

Open jonas-martinez opened 6 months ago

jonas-martinez commented 6 months ago

As you can see on the logs below, the script tries to access the projects.json file using a path that contains my WSL username "jonas". But the real path is using my Windows username which is "cbobb". We have to make sure that the script is properly using the right username which should be the Windows username in this case. Or maybe use a system defined variable like %appdata% if it corresponds.

jonas@cbobb-PC:~$ clone https://github.com/shiipou/clone-project-manager
GIT_HOME is not set. Using default value: /home/jonas/dev
Repo already exists
grep: /mnt/c/Users/jonas/AppData/Roaming/Code/User/globalStorage/alefragnani.project-manager/projects.json: No such file or directory
Adding the repo to the list of repos in VSCode's project manager extension...
/home/jonas/.local/bin/clone: line 79: /mnt/c/Users/jonas/AppData/Roaming/Code/User/globalStorage/alefragnani.project-manager/projects.json.tmp: No such file or directory
cat: /mnt/c/Users/jonas/AppData/Roaming/Code/User/globalStorage/alefragnani.project-manager/projects.json: No such file or directory
mv: cannot stat '/mnt/c/Users/jonas/AppData/Roaming/Code/User/globalStorage/alefragnani.project-manager/projects.json.tmp': No such file or directory
Your project is available at this path : 
         /home/jonas/dev/github.com/shiipou/clone-project-manager
Done
shiipou commented 6 months ago

@jonas-martinez Yeah I seen that, but it seems first impossible to check the right username now. Microsoft has changed a variable that before give us the windows username inside of the WSL2 and now we get the WSL2 username.

I'll search for a solution after work. Maybe I have to just list all directory inside of /mnt/c/Users/ and asking the user to press 1, 2, 3, ...

As workaround you can manually replace the variable with your username here : https://github.com/shiipou/clone-project-manager/blob/bd8d577db0467f7e240de6198fbc383756f9f1ec/clone#L31