Skip to content

Safety of local path operations: insufficient documentation. #71

Open
@vlang-intona

Description

@vlang-intona

The FileX API lets you change the current path with fx_directory_local_path_set(). Basically this function assigns a path to the supplied FX_LOCAL_PATH and makes it the current path. You can switch between multiple paths stored in FX_LOCAL_PATH using fx_directory_local_path_restore() to switch back and forth between directories.

I expect the documentation to provide enough information to answer this question: Is it safe to use multiple FX_LOCAL_PATH while directory entries are changed, such as creating or deleting files? Under which circumstances? Will "incorrect" use cause silent file system corruption? But the documentation doesn't say anything about any of this. I worry that this could be EXTREMELY error-prone if it's not just safe automatically. The documentation should explicitly list what is safe and what not.

My use case: I'm using FX_LOCAL_PATH to emulate chdir() (or alternatively functions openat()) in the hope that this will reduce the number of directory lookups (is that even true?). I'm also using it to emulate opendir(), because fx_directory_first_full_entry_find() etc. can only list the root directory, or the directory that was set with fx_directory_local_path_set().

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions