Code Monkey home page Code Monkey logo

Comments (6)

charlesroper avatar charlesroper commented on August 24, 2024 1

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:

Function GetById([LiteDB.LiteCollection[LiteDB.BSONDocument]]$collection, $id, $type) {
Find $collection ([LiteDB.Query]::EQ('_id', [LiteDB.BSONValue]::new($id))) $type
}
Function Find([LiteDB.LiteCollection[LiteDB.BSONDocument]]$collection, [LiteDB.Query]$query, $type) {
ForEach($document in $collection.Find([LiteDB.Query]$query)) {
ToObject $type $document
}
}

from zlocation.

iDCoded avatar iDCoded commented on August 24, 2024 1

@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 :).

from zlocation.

charlesroper avatar charlesroper commented on August 24, 2024

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.

from zlocation.

charlesroper avatar charlesroper commented on August 24, 2024

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.

from zlocation.

mattcargile avatar mattcargile commented on August 24, 2024

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?

from zlocation.

iDCoded avatar iDCoded commented on August 24, 2024

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.

from zlocation.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.