From cdc43e825cde1c7e68d0d4bf78d6444cd01d2f67 Mon Sep 17 00:00:00 2001 From: kichik Date: Thu, 12 Apr 2007 19:24:21 +0000 Subject: [PATCH] fixed bug #1699474 - file /a does not preserve folder attributes git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@5062 212acab6-be3b-0410-9dea-997c60f758d6 --- Source/script.cpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/Source/script.cpp b/Source/script.cpp index f1c37380..a9fca69c 100644 --- a/Source/script.cpp +++ b/Source/script.cpp @@ -5975,7 +5975,7 @@ int CEXEBuild::do_add_file(const char *lgss, int attrib, int recurse, int *total SCRIPT_MSG("%sFile: Descending to: \"%s\"\n", generatecode ? "" : "Reserve", new_spec.c_str()); - if (do_add_file_create_dir(*dirs_itr, new_dir, attrib) != PS_OK) { + if (do_add_file_create_dir(dir + '\\' + *dirs_itr, new_dir, attrib) != PS_OK) { return PS_ERROR; } @@ -6199,10 +6199,13 @@ int CEXEBuild::add_file(const string& dir, const string& file, int attrib, const ent.offsets[4]=0; ent.offsets[5]=0; - a=add_entry(&ent); - if (a != PS_OK) + if (ent.offsets[1] != INVALID_FILE_ATTRIBUTES) { - return a; + a=add_entry(&ent); + if (a != PS_OK) + { + return a; + } } #endif } @@ -6233,8 +6236,12 @@ int CEXEBuild::do_add_file_create_dir(const string& local_dir, const string& dir DWORD attr = GetFileAttributes(local_dir.c_str()); - if (add_entry_direct(EW_SETFILEATTRIBUTES, ndc, attr) != PS_OK) { - return PS_ERROR; + if (attr != INVALID_FILE_ATTRIBUTES) + { + if (add_entry_direct(EW_SETFILEATTRIBUTES, ndc, attr) != PS_OK) + { + return PS_ERROR; + } } } #endif