extras/physfsunpack.c
changeset 1631 1aec60db9326
parent 868 87ea5fcab4e9
equal deleted inserted replaced
1630:5123a32160af 1631:1aec60db9326
    26 
    26 
    27 
    27 
    28 static void fail(const char *what, const char *why)
    28 static void fail(const char *what, const char *why)
    29 {
    29 {
    30     if (why == NULL)
    30     if (why == NULL)
    31         why = PHYSFS_getLastError();
    31         why = PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode());
    32     fprintf(stderr, "%s failed: %s\n", what, why);
    32     fprintf(stderr, "%s failed: %s\n", what, why);
    33     failure = 1;
    33     failure = 1;
    34 } /* fail */
    34 } /* fail */
    35 
    35 
    36 
    36 
   148         return 1;
   148         return 1;
   149     } /* if */
   149     } /* if */
   150 
   150 
   151     if (!PHYSFS_init(argv[0]))
   151     if (!PHYSFS_init(argv[0]))
   152     {
   152     {
   153         fprintf(stderr, "PHYSFS_init() failed: %s\n", PHYSFS_getLastError());
   153         fprintf(stderr, "PHYSFS_init() failed: %s\n", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
   154         return 2;
   154         return 2;
   155     } /* if */
   155     } /* if */
   156 
   156 
   157     if (!PHYSFS_setWriteDir(argv[2]))
   157     if (!PHYSFS_setWriteDir(argv[2]))
   158     {
   158     {
   159         fprintf(stderr, "PHYSFS_setWriteDir('%s') failed: %s\n",
   159         fprintf(stderr, "PHYSFS_setWriteDir('%s') failed: %s\n",
   160                 argv[2], PHYSFS_getLastError());
   160                 argv[2], PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
   161         return 3;
   161         return 3;
   162     } /* if */
   162     } /* if */
   163 
   163 
   164     if (!PHYSFS_mount(argv[1], NULL, 1))
   164     if (!PHYSFS_mount(argv[1], NULL, 1))
   165     {
   165     {
   166         fprintf(stderr, "PHYSFS_mount('%s') failed: %s\n",
   166         fprintf(stderr, "PHYSFS_mount('%s') failed: %s\n",
   167                 argv[1], PHYSFS_getLastError());
   167                 argv[1], PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
   168         return 4;
   168         return 4;
   169     } /* if */
   169     } /* if */
   170 
   170 
   171     PHYSFS_permitSymbolicLinks(1);
   171     PHYSFS_permitSymbolicLinks(1);
   172     PHYSFS_enumerateFilesCallback("/", unpackCallback, &zero);
   172     PHYSFS_enumerateFilesCallback("/", unpackCallback, &zero);