mirror of
https://github.com/darlinghq/darling.git
synced 2024-11-26 22:00:29 +00:00
Fix Creating Default Output Path If File Is Not In CWD
This commit is contained in:
parent
7e4c0fd8ac
commit
b23cfe93d3
@ -8,6 +8,7 @@
|
||||
#include <errno.h>
|
||||
#include <sys/stat.h>
|
||||
#include <pwd.h>
|
||||
#include <libgen.h>
|
||||
|
||||
#include <mach-o/loader.h>
|
||||
#include <elf.h>
|
||||
@ -168,10 +169,14 @@ int main(int argc, char** argv) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (snprintf(default_output_name, sizeof(default_output_name), "darlingcore-%s", argv[1]) < 0) {
|
||||
char *tmp_output_dirname = strdup(argv[1]);
|
||||
char *tmp_output_basename = strdup(argv[1]);
|
||||
if (snprintf(default_output_name, sizeof(default_output_name), "%s/darlingcore-%s", dirname(tmp_output_dirname), basename(tmp_output_basename)) < 0) {
|
||||
perror("snprintf");
|
||||
return 1;
|
||||
}
|
||||
free(tmp_output_dirname); tmp_output_dirname = NULL;
|
||||
free(tmp_output_basename); tmp_output_basename = NULL;
|
||||
|
||||
const char* homedir = NULL;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user