Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

save: Perform write process safe #3273

Open
wants to merge 31 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
e994372
actions: SaveAs: Print the error of `os.Stat()` to the `InfoBar`
JoeKar Apr 29, 2024
c922261
actions: SaveCmd: Print the error of `SaveAs` to the `InfoBar`
JoeKar Dec 28, 2024
da1f6ff
save: Convert `os.IsNotExist()` into `errors.Is()`
JoeKar May 1, 2024
8b6736b
open & write: Process regular files only
JoeKar May 12, 2024
3c30659
buffer: Convert `os.Is()` into `errors.Is()`
JoeKar May 29, 2024
810a2c6
backup: Convert `os.IsNotExist()` into `errors.Is()`
JoeKar May 12, 2024
f383f24
backup: Store the file with the endings of the buffer
JoeKar May 23, 2024
0a8bef4
backup: Lock the buffer lines in `Backup()`
JoeKar May 24, 2024
aace932
bindings: Convert `os.IsNotExist()` into `errors.Is()`
JoeKar May 12, 2024
66b0a6e
clean: Inform about all failed write steps
JoeKar May 12, 2024
a13b568
clean: Remove some unneeded `filepath.Join()` calls
JoeKar May 12, 2024
70b49c3
util: Improve and rename `EscapePath()` to `DetermineEscapePath()`
JoeKar May 24, 2024
b15fd90
util: Generalize the file mode of 0666 with `util.FileMode`
JoeKar May 30, 2024
201852e
ioutil: Remove deprecated functions where possible
JoeKar May 30, 2024
cf8caab
save: Perform write process safe
JoeKar May 29, 2024
94e7506
actions: Don't overwrite the buffers `Path`
JoeKar Oct 1, 2024
b86bbe7
util: Provide `AppendBackupSuffix()` for further transformations
JoeKar Sep 3, 2024
8593ca1
backup: Perform write process safe
JoeKar May 31, 2024
0d7d95f
util: Provide `SafeWrite()` to generalize the internal file write pro…
JoeKar Aug 29, 2024
b82d9c4
serialize: Perform write process safe
JoeKar Jun 1, 2024
6f0ba17
bindings: Perform write process safe
JoeKar Jun 1, 2024
5a37163
settings: Perform write process safe
JoeKar Jun 1, 2024
010bf3e
save: Merge `overwrite()` into `overwriteFile()` and extract `writeFi…
JoeKar Oct 2, 2024
97c73b6
save: Further rework of `overwriteFile()`
JoeKar Nov 19, 2024
893e52c
micro: Generalize exit behavior
JoeKar Sep 8, 2024
1a8fc50
micro: Provide recovery of `settings.json` & `bindings.json`
JoeKar Sep 8, 2024
4a403d0
backup: Rearrange and extend `BackupMsg`
JoeKar Oct 30, 2024
1aede74
buffer: Remove superfluous `backupTime`
JoeKar Oct 12, 2024
72aeadb
save+backup: Process the `save` & `backup` with a sequential channel
JoeKar Oct 1, 2024
c7904a4
backup: Clear the requested backup upon completion notification
JoeKar Oct 12, 2024
fd97574
save+util: Provide a meaningful error message for safe (over-)write f…
JoeKar Nov 5, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
clean: Inform about all failed write steps
  • Loading branch information
JoeKar committed Dec 28, 2024
commit 66b0a6ed0289309adb2fbfeffb37b7e0c171d2f2
11 changes: 8 additions & 3 deletions cmd/micro/clean.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,12 @@ func CleanConfig() {
}

fmt.Println("Cleaning default settings")
config.WriteSettings(filepath.Join(config.ConfigDir, "settings.json"))

settingsFile := filepath.Join(config.ConfigDir, "settings.json")
err := config.WriteSettings(settingsFile)
if err != nil {
fmt.Println("Error writing settings.json file: " + err.Error())
}

// detect unused options
var unusedOptions []string
Expand Down Expand Up @@ -74,9 +79,9 @@ func CleanConfig() {
delete(config.GlobalSettings, s)
}

err := config.OverwriteSettings(filepath.Join(config.ConfigDir, "settings.json"))
err := config.OverwriteSettings(settingsFile)
if err != nil {
fmt.Println("Error writing settings.json file: " + err.Error())
fmt.Println("Error overwriting settings.json file: " + err.Error())
}

fmt.Println("Removed unused options")
Expand Down