ncls: properly separate paths #2063

pull/2083/head
nick black 3 years ago
parent 63c9889a89
commit f4bac90a17
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

@ -1747,8 +1747,8 @@ typedef struct ncvisual_implementation {
API extern ncvisual_implementation visual_implementation;
static inline char
path_seperator(void){
#if defined _WIN32 || defined __CYGWIN__
path_separator(void){
#ifdef __MINGW64__
return '\\';
#else
return '/';
@ -1764,7 +1764,7 @@ prefix_data(const char* base){
char* path = (char*)malloc(len); // cast for C++ includers
if(path){
memcpy(path, NOTCURSES_SHARE, dlen);
path[dlen] = path_seperator();
path[dlen] = path_separator();
strcpy(path + dlen + 1, base);
}
return path;

@ -42,9 +42,18 @@ struct job {
std::string p;
};
static inline char
path_separator(void){
#ifdef __MINGW64__
return '\\';
#else
return '/';
#endif
}
// FIXME see above; we ought have std::filesystem
auto path_join(const std::string& dir, const std::string& p) -> std::string {
return dir + p;
return dir + path_separator() + p;
}
static pthread_mutex_t mtx = PTHREAD_MUTEX_INITIALIZER;

@ -26,7 +26,7 @@ template <typename T> using uniqptr = std::unique_ptr<T,free_deleter>;
auto find_data(const char* datum) -> uniqptr<char> {
std::string s = datadir;
s += path_seperator();
s += path_separator();
s += datum;
uniqptr<char> uptr(strdup(s.c_str()));
return uptr;

Loading…
Cancel
Save