The cache directory will now be created if it doesn't already exist
This commit is contained in:
@@ -97,3 +97,12 @@ size_t utils_distance(const char* haystack, const char* needle) {
|
||||
|
||||
return arr[str1_len][str2_len];
|
||||
}
|
||||
|
||||
void utils_mkdir(char* path, mode_t mode) {
|
||||
if(access(path, F_OK) != 0) {
|
||||
char* tmp = strdup(path);
|
||||
utils_mkdir(dirname(tmp), mode);
|
||||
mkdir(path, mode);
|
||||
free(tmp);
|
||||
}
|
||||
}
|
||||
|
@@ -566,6 +566,11 @@ void wofi_write_cache(struct mode* mode, const char* _cmd) {
|
||||
char* cmd = escape_lf(_cmd);
|
||||
|
||||
char* cache_path = get_cache_path(mode->name);
|
||||
|
||||
char* tmp_dir = strdup(cache_path);
|
||||
utils_mkdir(dirname(tmp_dir), S_IRWXU | S_IRGRP | S_IXGRP);
|
||||
free(tmp_dir);
|
||||
|
||||
struct wl_list lines;
|
||||
wl_list_init(&lines);
|
||||
bool inc_count = false;
|
||||
|
Reference in New Issue
Block a user