fixed bug #1082017 - Problem with empty dir in File /r
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@3819 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
aea5022f96
commit
8cf1113c5b
2 changed files with 33 additions and 23 deletions
|
@ -148,7 +148,7 @@ class CEXEBuild {
|
||||||
int do_add_file(const char *lgss, int attrib, int recurse, int *total_files, const char
|
int do_add_file(const char *lgss, int attrib, int recurse, int *total_files, const char
|
||||||
*name_override=0, int generatecode=1, int *data_handle=0,
|
*name_override=0, int generatecode=1, int *data_handle=0,
|
||||||
const std::set<std::string>& excluded=std::set<std::string>(),
|
const std::set<std::string>& excluded=std::set<std::string>(),
|
||||||
const std::string& basedir=std::string(""));
|
const std::string& basedir=std::string(""), bool dir_created=false);
|
||||||
int add_file(const std::string& dir, const std::string& file, int attrib, const char
|
int add_file(const std::string& dir, const std::string& file, int attrib, const char
|
||||||
*name_override, int generatecode, int *data_handle);
|
*name_override, int generatecode, int *data_handle);
|
||||||
int do_add_file_create_dir(const std::string& local_dir, const std::string& dir, int attrib=0);
|
int do_add_file_create_dir(const std::string& local_dir, const std::string& dir, int attrib=0);
|
||||||
|
|
|
@ -5600,7 +5600,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef NSIS_SUPPORT_FILE
|
#ifdef NSIS_SUPPORT_FILE
|
||||||
int CEXEBuild::do_add_file(const char *lgss, int attrib, int recurse, int *total_files, const char *name_override, int generatecode, int *data_handle, const set<string>& excluded, const string& basedir)
|
int CEXEBuild::do_add_file(const char *lgss, int attrib, int recurse, int *total_files, const char *name_override, int generatecode, int *data_handle, const set<string>& excluded, const string& basedir, bool dir_created)
|
||||||
{
|
{
|
||||||
assert(!name_override || !recurse);
|
assert(!name_override || !recurse);
|
||||||
|
|
||||||
|
@ -5625,8 +5625,6 @@ int CEXEBuild::do_add_file(const char *lgss, int attrib, int recurse, int *total
|
||||||
dir_reader::iterator files_itr = dr->files().begin();
|
dir_reader::iterator files_itr = dr->files().begin();
|
||||||
dir_reader::iterator files_end = dr->files().end();
|
dir_reader::iterator files_end = dr->files().end();
|
||||||
|
|
||||||
bool dir_created = false;
|
|
||||||
|
|
||||||
if (basedir == "") {
|
if (basedir == "") {
|
||||||
dir_created = true;
|
dir_created = true;
|
||||||
|
|
||||||
|
@ -5639,6 +5637,7 @@ int CEXEBuild::do_add_file(const char *lgss, int attrib, int recurse, int *total
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// add files in the current directory
|
||||||
for (; files_itr != files_end; files_itr++) {
|
for (; files_itr != files_end; files_itr++) {
|
||||||
if (!dir_reader::matches(*files_itr, spec))
|
if (!dir_reader::matches(*files_itr, spec))
|
||||||
continue;
|
continue;
|
||||||
|
@ -5662,12 +5661,14 @@ int CEXEBuild::do_add_file(const char *lgss, int attrib, int recurse, int *total
|
||||||
(*total_files)++;
|
(*total_files)++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// recurse into directories
|
||||||
if (recurse) {
|
if (recurse) {
|
||||||
dir_reader::iterator dirs_itr = dr->dirs().begin();
|
dir_reader::iterator dirs_itr = dr->dirs().begin();
|
||||||
dir_reader::iterator dirs_end = dr->dirs().end();
|
dir_reader::iterator dirs_end = dr->dirs().end();
|
||||||
|
|
||||||
for (; dirs_itr != dirs_end; dirs_itr++) {
|
for (; dirs_itr != dirs_end; dirs_itr++) {
|
||||||
string new_dir;
|
string new_dir;
|
||||||
|
bool created = false;
|
||||||
|
|
||||||
if (basedir == "") {
|
if (basedir == "") {
|
||||||
new_dir = *dirs_itr;
|
new_dir = *dirs_itr;
|
||||||
|
@ -5679,11 +5680,20 @@ int CEXEBuild::do_add_file(const char *lgss, int attrib, int recurse, int *total
|
||||||
|
|
||||||
if (!dir_reader::matches(*dirs_itr, spec)) {
|
if (!dir_reader::matches(*dirs_itr, spec)) {
|
||||||
new_spec += spec;
|
new_spec += spec;
|
||||||
|
} else if (generatecode) {
|
||||||
|
// always create directories that match
|
||||||
|
if (do_add_file_create_dir(*dirs_itr, new_dir, attrib) != PS_OK) {
|
||||||
|
delete dr;
|
||||||
|
return PS_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
created = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *new_spec_c = new_spec.c_str();
|
const char *new_spec_c = new_spec.c_str();
|
||||||
|
|
||||||
if (do_add_file(new_spec_c, attrib, 1, total_files, NULL, generatecode, NULL, excluded, new_dir) != PS_OK) {
|
int res = do_add_file(new_spec_c, attrib, 1, total_files, NULL, generatecode, NULL, excluded, new_dir, created);
|
||||||
|
if (res != PS_OK) {
|
||||||
delete dr;
|
delete dr;
|
||||||
return PS_ERROR;
|
return PS_ERROR;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue