The archiver now uses a predictable file order when creating an archive.
[ARCHIVER] * BUG: The archiver now uses a predictable file order when creating an archive.
This commit is contained in:
parent
a71bfa4932
commit
39f93ddb37
@ -227,8 +227,9 @@ static int path_count(void)
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
DIR *dir;
|
||||
const char *path;
|
||||
int nfile;
|
||||
struct dirent **filelist;
|
||||
struct dirent *dirent;
|
||||
char *file_name;
|
||||
const char *file;
|
||||
@ -240,6 +241,7 @@ int main(int argc, char **argv)
|
||||
const char **remove_ext;
|
||||
ARCH *arch;
|
||||
ARCH_FIND find;
|
||||
int i;
|
||||
|
||||
get_arguments(argc, argv);
|
||||
COMMON_init();
|
||||
@ -279,22 +281,26 @@ int main(int argc, char **argv)
|
||||
break;
|
||||
|
||||
path = path_list[path_current++];
|
||||
dir = opendir(path);
|
||||
|
||||
if (dir == NULL)
|
||||
{
|
||||
fprintf(stderr, "gba: warning: Cannot open dir: %s\n", path);
|
||||
goto _NEXT_PATH;
|
||||
}
|
||||
|
||||
|
||||
if (chdir(path) != 0)
|
||||
{
|
||||
fprintf(stderr, "gba: warning: Cannot change dir: %s\n", path);
|
||||
fprintf(stderr, "gba: warning: cannot change to directory: %s\n", path);
|
||||
goto _NEXT_PATH;
|
||||
}
|
||||
|
||||
while ((dirent = readdir(dir)) != NULL)
|
||||
filelist = NULL;
|
||||
nfile = scandir(path, &filelist, NULL, alphasort);
|
||||
|
||||
if (nfile < 0)
|
||||
{
|
||||
fprintf(stderr, "gba: warning: cannot scan directory: %s\n", path);
|
||||
goto _NEXT_PATH;
|
||||
}
|
||||
|
||||
for (i = 0; i < nfile; i++)
|
||||
{
|
||||
dirent = filelist[i];
|
||||
|
||||
file_name = dirent->d_name;
|
||||
len = strlen(file_name);
|
||||
|
||||
@ -381,7 +387,9 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
_NEXT_PATH:
|
||||
if (dir != NULL) closedir(dir);
|
||||
if (filelist != NULL)
|
||||
free(filelist);
|
||||
|
||||
FREE((char **)&path);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user