Skip to content

Commit

Permalink
Build output directory if not exist
Browse files Browse the repository at this point in the history
Signed-off-by: Shaka Huang <[email protected]>
  • Loading branch information
shakalaca committed Jul 14, 2015
1 parent 902401a commit a7001e8
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions unpackbootimg.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#include <errno.h>
#include <limits.h>
#include <libgen.h>
#include <sys/types.h>
#include <sys/stat.h>

#include "mincrypt/sha.h"
#include "bootimg.h"
Expand Down Expand Up @@ -113,6 +115,12 @@ int main(int argc, char** argv)
if (pagesize == 0) {
pagesize = header.page_size;
}

struct stat st = {0};

if (stat(directory, &st) == -1) {
mkdir(directory, 0755);
}

//printf("cmdline...\n");
sprintf(tmp, "%s/%s", directory, basename(filename));
Expand Down

0 comments on commit a7001e8

Please sign in to comment.