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

micro: accept relative file paths #132

Merged
merged 1 commit into from
Mar 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
VERSION=0.2dev
DEBUG?=false

all: kernel shell build micro hugo
all: kernel shell build micro

dev: all
go run ./dev
Expand Down
16 changes: 16 additions & 0 deletions external/micro/wanix_vendor.patch
Original file line number Diff line number Diff line change
Expand Up @@ -160,3 +160,19 @@ index 3e6756bc..9f71377b 100644
}
return
}
diff --git a/internal/buffer/buffer.go b/internal/buffer/buffer.go
index dc4d037f..8e09ed32 100644
--- a/internal/buffer/buffer.go
+++ b/internal/buffer/buffer.go
@@ -234,6 +234,11 @@ func NewBufferFromFileAtLoc(path string, btype BufType, cursorLoc Loc) (*Buffer,
return nil, err
}

+ filename, err = filepath.Abs(filename)
+ if err != nil {
+ return nil, err
+ }
+
f, err := os.OpenFile(filename, os.O_WRONLY, 0)
readonly := os.IsPermission(err)
f.Close()