aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/os/fs.c
diff options
context:
space:
mode:
authorJosh Rahm <rahm@google.com>2022-10-11 19:00:52 +0000
committerJosh Rahm <rahm@google.com>2022-10-11 19:00:52 +0000
commit21e2e46242033c7aaa6ccfb23e256680816c063c (patch)
treef089522cfb145d6e9c8a86a01d8e454ce5501e20 /src/nvim/os/fs.c
parent179d3ed87b17988f5fe00d8b99f2611a28212be7 (diff)
parent760b399f6c0c6470daa0663752bd22886997f9e6 (diff)
downloadrneovim-floattitle.tar.gz
rneovim-floattitle.tar.bz2
rneovim-floattitle.zip
Merge remote-tracking branch 'upstream/master' into floattitlefloattitle
Diffstat (limited to 'src/nvim/os/fs.c')
-rw-r--r--src/nvim/os/fs.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/src/nvim/os/fs.c b/src/nvim/os/fs.c
index 0d62a5f5f9..68e96eea6e 100644
--- a/src/nvim/os/fs.c
+++ b/src/nvim/os/fs.c
@@ -27,7 +27,7 @@
#include "nvim/path.h"
#include "nvim/strings.h"
-#ifdef WIN32
+#ifdef MSWIN
# include "nvim/mbyte.h" // for utf8_to_utf16, utf16_to_utf8
#endif
@@ -129,10 +129,10 @@ bool os_isrealdir(const char *name)
/// Check if the given path exists and is a directory.
///
/// @return `true` if `name` is a directory.
-bool os_isdir(const char_u *name)
+bool os_isdir(const char *name)
FUNC_ATTR_NONNULL_ALL
{
- int32_t mode = os_getperm((const char *)name);
+ int32_t mode = os_getperm(name);
if (mode < 0) {
return false;
}
@@ -151,7 +151,7 @@ bool os_isdir(const char_u *name)
int os_nodetype(const char *name)
FUNC_ATTR_NONNULL_ALL
{
-#ifndef WIN32 // Unix
+#ifndef MSWIN // Unix
uv_stat_t statbuf;
if (0 != os_stat(name, &statbuf)) {
return NODE_NORMAL; // File doesn't exist.
@@ -241,7 +241,7 @@ bool os_can_exe(const char *name, char **abspath, bool use_path)
FUNC_ATTR_NONNULL_ARG(1)
{
if (!use_path || gettail_dir(name) != name) {
-#ifdef WIN32
+#ifdef MSWIN
if (is_executable_ext(name, abspath)) {
#else
// Must have path separator, cannot execute files in the current directory.
@@ -270,7 +270,7 @@ static bool is_executable(const char *name, char **abspath)
return false;
}
-#ifdef WIN32
+#ifdef MSWIN
// Windows does not have exec bit; just check if the file exists and is not
// a directory.
const bool ok = S_ISREG(mode);
@@ -287,7 +287,7 @@ static bool is_executable(const char *name, char **abspath)
return ok;
}
-#ifdef WIN32
+#ifdef MSWIN
/// Checks if file `name` is executable under any of these conditions:
/// - extension is in $PATHEXT and `name` is executable
/// - result of any $PATHEXT extension appended to `name` is executable
@@ -351,7 +351,7 @@ static bool is_executable_in_path(const char *name, char **abspath)
return false;
}
-#ifdef WIN32
+#ifdef MSWIN
// Prepend ".;" to $PATH.
size_t pathlen = strlen(path_env);
char *path = memcpy(xmallocz(pathlen + 2), "." ENV_SEPSTR, 2);
@@ -374,7 +374,7 @@ static bool is_executable_in_path(const char *name, char **abspath)
STRLCPY(buf, p, e - p + 1);
append_path(buf, name, buf_len);
-#ifdef WIN32
+#ifdef MSWIN
if (is_executable_ext(buf, abspath)) {
#else
if (is_executable(buf, abspath)) {
@@ -446,7 +446,7 @@ FILE *os_fopen(const char *path, const char *flags)
default:
abort();
}
-#ifdef WIN32
+#ifdef MSWIN
if (flags[1] == 'b') {
iflags |= O_BINARY;
}
@@ -821,10 +821,10 @@ int os_fchown(int fd, uv_uid_t owner, uv_gid_t group)
/// Check if a path exists.
///
/// @return `true` if `path` exists
-bool os_path_exists(const char_u *path)
+bool os_path_exists(const char *path)
{
uv_stat_t statbuf;
- return os_stat((char *)path, &statbuf) == kLibuvSuccess;
+ return os_stat(path, &statbuf) == kLibuvSuccess;
}
/// Sets file access and modification times.
@@ -865,7 +865,7 @@ int os_file_is_writable(const char *name)
int r;
RUN_UV_FS_FUNC(r, uv_fs_access, name, W_OK, NULL);
if (r == 0) {
- return os_isdir((char_u *)name) ? 2 : 1;
+ return os_isdir(name) ? 2 : 1;
}
return 0;
}
@@ -911,11 +911,11 @@ int os_mkdir_recurse(const char *const dir, int32_t mode, char **const failed_di
// We're done when it's "/" or "c:/".
const size_t dirlen = strlen(dir);
char *const curdir = xmemdupz(dir, dirlen);
- char *const past_head = (char *)get_past_head((char_u *)curdir);
+ char *const past_head = get_past_head(curdir);
char *e = curdir + dirlen;
const char *const real_end = e;
const char past_head_save = *past_head;
- while (!os_isdir((char_u *)curdir)) {
+ while (!os_isdir(curdir)) {
e = path_tail_with_sep(curdir);
if (e <= past_head) {
*past_head = NUL;
@@ -1208,7 +1208,7 @@ char *os_realpath(const char *name, char *buf)
return result == kLibuvSuccess ? buf : NULL;
}
-#ifdef WIN32
+#ifdef MSWIN
# include <shlobj.h>
/// When "fname" is the name of a shortcut (*.lnk) resolve the file it points