Use chsrc_check_file()

This commit is contained in:
Aoran Zeng
2023-09-26 22:24:48 +08:00
parent eb0bd01d4c
commit f1ec6f8399
2 changed files with 23 additions and 23 deletions

13
chsrc.h
View File

@@ -272,7 +272,6 @@ not_root:
#define chsrc_warn(str) xy_warn(xy_2strjoin(App_Prefix, (str)))
#define chsrc_error(str) xy_error(xy_2strjoin(App_Prefix, (str)))
static void
chsrc_run (const char* cmd)
{
@@ -280,6 +279,18 @@ chsrc_run (const char* cmd)
system(cmd);
}
static void
chsrc_check_file (const char* path)
{
char* cmd = NULL;
if(xy_on_windows) {
cmd = xy_2strjoin ("type ", path);
} else {
cmd = xy_2strjoin ("cat ", path);
}
chsrc_run (cmd);
}
static void
chsrc_append_to_file (const char* str, const char* file)
{