Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Optionally fail to load buffers from missing files #259

Merged
merged 4 commits into from
Sep 19, 2017

Conversation

smashwilson
Copy link
Contributor

By default, TextBuffer will deserialize or load files that do not exist as empty buffers. As a consequence, when you open Atom after deleting or moving a file that was open in an editor in a previous session (or checking out a different git branch, or unmounting a drive...) your workspace is created with empty TextEditors.

We also have some time-of-check, time-of-use race conditions in Project deserialization that are caused by needing to detect certain failure conditions before calling TextBuffer.deserialize().

This adds a mustExist: option to TextBuffer's load and deserialization methods that cause the ENOENT error to propagate to the caller, which can then report it or skip it based on higher-level abstraction logic.

Prerequisite for the last bits of atom/atom#15681.

@smashwilson smashwilson merged commit fe1f388 into master Sep 19, 2017
@smashwilson smashwilson deleted the aw-omit-deleted branch September 19, 2017 16:57
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant