You've already forked Magisk
mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-09-06 06:36:58 +00:00
Store hidelist in magisk database
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
#include <unistd.h>
|
||||
|
||||
#include "utils.hpp"
|
||||
|
||||
int file_to_array(const char *filename, Array<char *> &arr) {
|
||||
if (access(filename, R_OK) != 0)
|
||||
return 1;
|
||||
char *line = NULL;
|
||||
size_t len = 0;
|
||||
ssize_t read;
|
||||
|
||||
FILE *fp = xfopen(filename, "r");
|
||||
if (fp == NULL)
|
||||
return 1;
|
||||
|
||||
while ((read = getline(&line, &len, fp)) != -1) {
|
||||
// Remove end newline
|
||||
if (line[read - 1] == '\n')
|
||||
line[read - 1] = '\0';
|
||||
arr.push_back(line);
|
||||
line = NULL;
|
||||
}
|
||||
fclose(fp);
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user