-
Notifications
You must be signed in to change notification settings - Fork 136
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
Add config key to set the file creation permissions #537
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -36,9 +36,10 @@ M.abspath = function(path) | |||
end | ||||
|
||||
---@param path string | ||||
---@param mode integer mode to open file (octal) | ||||
---@param cb fun(err: nil|string) | ||||
M.touch = function(path, cb) | ||||
uv.fs_open(path, "a", 420, function(err, fd) -- 0644 | ||||
M.touch = function(path, mode, cb) | ||||
uv.fs_open(path, "a", mode, function(err, fd) | ||||
if err then | ||||
cb(err) | ||||
else | ||||
|
@@ -146,7 +147,6 @@ end | |||
---@param dir string | ||||
---@param mode? integer | ||||
M.mkdirp = function(dir, mode) | ||||
mode = mode or 493 | ||||
local mod = "" | ||||
Comment on lines
148
to
150
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. According to the docs, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, the idea is to use the config value, and now we have a default one, so it's always available There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Then you'll need to update the function signature to make mode non-optional, and update the call here to pass the mode oil.nvim/lua/oil/adapters/ssh.lua Line 371 in c12fad2
|
||||
local path = dir | ||||
while vim.fn.isdirectory(path) == 0 do | ||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: you don't actually need the
tostring()
here.tonumber
will convert an integer or a string the same way.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure about it, i try the following code:
and I get the following error:
I'm not a Lua expert, in fact this is my first productive code in Lua, so maybe I'm ignoring something
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the second argument to tonumber is the base to interpret the number as. 493 is not a valid octal number. If you do
tonumber(755, 8)
it prints out493
as expectedThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again the same:
Maybe this has something to do with my interpreter? to run this examples I used the standalone interpreter:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh interesting, must be a difference between LuaJIT and Lua then (or 5.1 and 5.4). I retract the nit