Skip to main content

Module folder_import

Module folder_import 

Source
Expand description

Importing a folder from disk with its structure kept, after Eagle’s uploadFolderToSidebar: the folder becomes an Eagle folder of the same name, each subfolder a child folder, and every file is imported into the folder that mirrors its parent directory.

walk reads the tree, plan turns it into folders to create and files to import, and Library::create_folders adds the folders in one metadata.json write. Importing the files is left to the caller, which stages them on another thread.

Structs§

NewFolder
A folder to create for an imported tree.
Plan
What importing a Tree does to a library.
Stats
The size of a walked tree.
Tree
A directory as walked from disk.

Enums§

Verdict
Whether a folder may be imported, after Eagle’s limits in uploadFolderToSidebar.

Constants§

MAX_DEPTH
…or this many levels of folders or more.
MAX_FILES
Eagle refuses a folder with this many files or more…
WARN_FILES
From this many files Eagle asks before importing a folder.

Functions§

is_pixave_library
Pixave libraries, which folder import skips as Eagle’s Import Folders does.
is_skipped
Whether a walk leaves name out: hidden files and OS junk.
plan
Maps a walked tree to the folders to create and the file imports, with the top folder placed in parent (or at the top level). new_id gives each folder its id.
verdict
Eagle’s limits: 15 levels or more, or 100,000 files or more, are refused; 2,000 files or more need a confirmation.
walk
Reads dir and everything under it. Hidden files and junk are left out; packages count as files. Symbolic links to folders are not followed, so a link cycle can’t make the walk endless. Unreadable subfolders come back empty.