mirror of
https://github.com/tomasriveral/NoteWrapper.git
synced 2026-08-11 18:18:36 +02:00
CI: fix immediate crash
This commit is contained in:
@@ -22,8 +22,8 @@ jobs:
|
|||||||
pkg-config \
|
pkg-config \
|
||||||
libcjson-dev \
|
libcjson-dev \
|
||||||
libncurses-dev \
|
libncurses-dev \
|
||||||
git
|
git \
|
||||||
|
neovim
|
||||||
- name: Build
|
- name: Build
|
||||||
run: make
|
run: make
|
||||||
|
|
||||||
|
|||||||
+13
-3
@@ -1,4 +1,6 @@
|
|||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
#include "unistd.h"
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
const char *supportedEditor[] = {"helix", "jed", "kakoune", "micro", "nano", "neovim", "vi", "vim"};
|
const char *supportedEditor[] = {"helix", "jed", "kakoune", "micro", "nano", "neovim", "vi", "vim"};
|
||||||
const int numEditors = 8;
|
const int numEditors = 8;
|
||||||
@@ -112,17 +114,25 @@ static void ensureDir(const char *path, const int shouldDebug) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void initAppFilesAndDirs(const char *home, const int shouldDebug) {
|
void initAppFilesAndDirs(const char *home, const int shouldDebug) {
|
||||||
|
// sometimes .cache and .config doesn't exist. Such as with github actions machines
|
||||||
char config_dir[PATH_MAX];
|
char config_dir[PATH_MAX];
|
||||||
char cache_dir[PATH_MAX];
|
char cache_dir[PATH_MAX];
|
||||||
|
|
||||||
snprintf(config_dir, sizeof(config_dir),
|
snprintf(config_dir, sizeof(config_dir),
|
||||||
"%s/.config/notewrapper", home);
|
"%s/.config/", home);
|
||||||
|
|
||||||
snprintf(cache_dir, sizeof(cache_dir),
|
snprintf(cache_dir, sizeof(cache_dir),
|
||||||
"%s/.cache/notewrapper", home);
|
"%s/.cache/", home);
|
||||||
|
|
||||||
ensureDir(config_dir, shouldDebug);
|
ensureDir(config_dir, shouldDebug);
|
||||||
ensureDir(cache_dir, shouldDebug);
|
ensureDir(cache_dir, shouldDebug);
|
||||||
|
|
||||||
|
strncat(config_dir, "notewrapper/", PATH_MAX);
|
||||||
|
strncat(cache_dir, "notewrapper/", PATH_MAX);
|
||||||
|
|
||||||
|
ensureDir(config_dir, shouldDebug);
|
||||||
|
ensureDir(cache_dir, shouldDebug);
|
||||||
|
|
||||||
|
|
||||||
char config_file[PATH_MAX+12];
|
char config_file[PATH_MAX+12];
|
||||||
snprintf(config_file, sizeof(config_file), "%s/config.json", config_dir);
|
snprintf(config_file, sizeof(config_file), "%s/config.json", config_dir);
|
||||||
|
|||||||
Reference in New Issue
Block a user