Skip to content

feat(folders): create a new folder while picking one to open - #8

Closed
Jonathan-Asher wants to merge 1 commit into
upstream-mainfrom
pr/new-folder
Closed

Jonathan-Asher wants to merge 1 commit into
upstream-mainfrom
pr/new-folder

Conversation

@Jonathan-Asher

Copy link
Copy Markdown
Owner

CI run of upstream's test.yml for the upstream PR branch pr/new-folder. Not for merging.

Starting a project in an empty folder meant leaving codeg to make the
folder first: the Open folder dialog could only pick a directory that
already existed, and in web mode there was no other way to make one on
the server at all.

The dialog's directory browser now has a New folder button beside Home
and Up. It opens a name box at the top of the listing; Enter creates the
folder in the directory being listed, and the browser moves into it, so
Next opens it as the workspace. Escape or the X cancels without closing
the dialog. A rejected name is explained under the box, which keeps what
was typed. DirectoryBrowser takes this as an opt-in allowCreateFolder
prop, so the other pickers that embed it are unchanged.

The folder is made by create_directory_core, shared by the Tauri command
and POST /api/create_directory. It trims the name and rejects empty
names, "." and "..", path separators and control characters (plus the
names and characters Windows reserves, on Windows), needs an absolute,
existing parent, creates exactly one directory, and reports an existing
entry of that name, symlinks included, instead of reusing or following
it. Errors are a thiserror enum mapped onto the existing error codes
(400/404/409/403/500) with i18n keys, translated in all ten locales.

The native folder picker now asks for canCreateDirectories, the macOS
panel's own New Folder button. tauri-plugin-dialog already defaults it to
on; this keeps it on.
@Jonathan-Asher

Copy link
Copy Markdown
Owner Author

Upstream test.yml passed on all 7 jobs (run 37311141140). Opened upstream as spacering-net#881.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant