Giter Site home page Giter Site logo

Getting a FileEntry by path about aspen HOT 7 CLOSED

LoganDark avatar LoganDark commented on June 22, 2024
Getting a FileEntry by path

from aspen.

Comments (7)

LoganDark avatar LoganDark commented on June 22, 2024

Maybe this is an XY problem and the real solution would be to allow me to modify metadata using inotify. Doesn't really matter in the end

from aspen.

zikaari avatar zikaari commented on June 22, 2024

IsforceLoadFileentryAtPath not returning you the handle?

Also since you say you are trying to get a handle after the rename, could it be that you are querying the old file by mistake?

Also note that if inotify is used properly, the FileEntry object reference remains the same even after it is renamed, again this is assuming inotify was provided with appropriate info.

from aspen.

LoganDark avatar LoganDark commented on June 22, 2024

IsforceLoadFileentryAtPath not returning you the handle?

I... did not know that function existed.

Also since you say you are trying to get a handle after the rename, could it be that you are querying the old file by mistake?

Considering I couldn't find out how to run any query, no.

Also note that if inotify is used properly, the FileEntry object reference remains the same even after it is renamed, again this is assuming inotify was provided with appropriate info.

Exactly, this is why it's not being populated with the correct metadata.

I'll try out forceLoadFileentryAtPath, but I'd prefer not to force a load if aspen is not yet interested (i.e. parents haven't been expanded and such).

from aspen.

LoganDark avatar LoganDark commented on June 22, 2024

Turns out none of that was needed.

The solution I settled on was to check if, during a rename, the new path is a different "kind" of file than the old path (as in the metadata needs changing). If so, just delete the old path and use an Added event to create the new one.

The code looks something like this:

image

from aspen.

LoganDark avatar LoganDark commented on June 22, 2024

Now I need this for a different reason - chokidar likes to fire 8 billion add events immediately upon startup, and there is no way to turn that off. Aspen reads the files, but then chokidar fires its 8 billion add events for those entries that already exist - long story short, there end up being multiple instances of the same path in the tree view.

Alternatively aspen-core could like not add duplicate entries since this apparently is such a common behavior that not a single chokidar issue mentions it.

from aspen.

zikaari avatar zikaari commented on June 22, 2024

Did you try the ignoreInitial option of chokidar?

from aspen.

LoganDark avatar LoganDark commented on June 22, 2024

Did you try the ignoreInitial option of chokidar?

I did not know that existed, it has such a non-obvious name. I literally did search all the members of WatchOptions too. Thanks

from aspen.

Related Issues (16)

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.