Closed iDCoded closed 2 years ago
I have a similar problem. I have just installed ZLocation and this is what the straight z
command gives me:
[ pwsh] ~
➜ z
Weight Path
------ ----
0 ::{20D04FE0-3AEA-1069-A2D8-08002B30309D}
0 ::{645FF040-5081-101B-9F08-00AA002F954E}
0 C:\inetpub
0 C:\Users\Charles
0 C:\Users\Charles\Desktop
0 C:\Users\Charles\Dev
0 C:\Users\Charles\Downloads
0 C:\Users\Charles\OneDrive\Music
I'm not sure why it has these particular directories in the database.
If I cd to a few different directories, they do not seem to be getting added to the db.
[ pwsh] ~
➜ z
Weight Path
------ ----
0 ::{20D04FE0-3AEA-1069-A2D8-08002B30309D}
0 ::{645FF040-5081-101B-9F08-00AA002F954E}
0 C:\inetpub
0 C:\Users\Charles
0 C:\Users\Charles\Desktop
0 C:\Users\Charles\Dev
0 C:\Users\Charles\Downloads
0 C:\Users\Charles\OneDrive\Music
[ pwsh] ~
➜ cd .\Dev\JavaScript\
[ pwsh] ~\..\JavaScript
➜ z
Weight Path
------ ----
0 ::{20D04FE0-3AEA-1069-A2D8-08002B30309D}
0 ::{645FF040-5081-101B-9F08-00AA002F954E}
0 C:\inetpub
0 C:\Users\Charles
0 C:\Users\Charles\Desktop
0 C:\Users\Charles\Dev
0 C:\Users\Charles\Downloads
0 C:\Users\Charles\OneDrive\Music
[ pwsh] ~\..\JavaScript
➜ cd -
[ pwsh] ~
➜ z JavaScript
WARNING: Cannot find matching location
Not sure if I've done something dumb or if there's a genuine problem. The z-location.db
file does not seem to be getting updated when I cd around - timestamp and size stay the same.
Further to this, I just tried uninstalling (and deleting the z-location.db file) and reinstalling. This time I saw this:
[ pwsh] ~
➜ Install-Module ZLocation -Scope CurrentUser; Import-Module ZLocation;
[fd error]: Search path '(_id = ::{20D04FE0-3AEA-1069-A2D8-08002B30309D})' is not a directory.
[fd error]: Search path 'Location' is not a directory.
[fd error]: No valid search paths given.
[fd error]: Search path '(_id = C:\\Users\\Charles)' is not a directory.
[fd error]: Search path 'Location' is not a directory.
[fd error]: No valid search paths given.
[fd error]: Search path '(_id = C:\\Users\\Charles\\Dev)' is not a directory.
[fd error]: Search path 'Location' is not a directory.
[fd error]: No valid search paths given.
[fd error]: Search path '(_id = C:\\inetpub)' is not a directory.
[fd error]: Search path 'Location' is not a directory.
[fd error]: No valid search paths given.
[fd error]: Search path '(_id = ::{645FF040-5081-101B-9F08-00AA002F954E})' is not a directory.
[fd error]: Search path 'Location' is not a directory.
[fd error]: No valid search paths given.
[fd error]: Search path '(_id = C:\\Users\\Charles\\Downloads)' is not a directory.
[fd error]: Search path 'Location' is not a directory.
[fd error]: No valid search paths given.
[fd error]: Search path '(_id = C:\\Users\\Charles\\OneDrive\\Music)' is not a directory.
[fd error]: Search path 'Location' is not a directory.
[fd error]: No valid search paths given.
[fd error]: Search path '(_id = C:\\Users\\Charles\\Desktop)' is not a directory.
[fd error]: Search path 'Location' is not a directory.
[fd error]: No valid search paths given.
ZLocation
does edit the function:\prompt
so maybe there is something weird going on. You just need to add Update-ZLocation $PWD
to the aforementioned function. Additionally, by default ZLocation
adds your Quick Access Frequent Folders so maybe there is something going on there too?
Firstly, @iDCoded, I must apologise for crashing your issue. Your question was:
Is there anything I can do to add the location of a directory to ZLocation
An answer to this is to change to the directory, then run Update-ZLocation $PWD
. This should add the current directory. Or you could pass in any directory instead of $PWD
.
If this does not work, you probably have some other problem going on. Seeing as you already have plenty of other items in your history, could it be something you installed recently? Is your problem only showing up on this specific directory or all?
As for my issue, after a lot of hair pulling and eventually commenting out each thing in my profile, the weirdness was down to this line:
Set-Alias find fd
I had overridden find.exe
with fd (possibly not the best idea in hindsight, especially as typing 'fd' is two characters easier 😆).
I suspect (not sure) this lead to a clash with: https://github.com/vors/ZLocation/blob/982799a453ee2f7454a959ffd193e5f9709045b7/ZLocation/ZLocation.LiteDB.psm1#L30-L38
An answer to this is to change to the directory, then run Update-ZLocation $PWD. This should add the current directory. Or you could pass in any directory instead of $PWD.
I'll try this and update if the issue continues.
@charlesroper I have tried that and it successfully worked the way it was intended. Thanks a bunch for your assistance, I will now be closing this issue :).
This might not exactly be an issue, rather my lack of knowledge of ZLocation, but nevertheless, The problem I am facing is I am not able to add directories, that I keep visiting quite frequently to ZLocation.
Is there anything I can do to add the location of a directory to ZLocation
So, I want to add a directory
C:\Users\me\OneDrive\Documents\JavaScript
to show up in Z, is there any way I can achieve so.