diff options
author | Pierre-André Jacquod <pjacquod@alumni.ethz.ch> | 2011-09-09 21:58:21 +0200 |
---|---|---|
committer | Tor Lillqvist <tlillqvist@suse.com> | 2011-09-12 10:21:21 +0300 |
commit | e5f99329f812a00c0fb104306ea5f33d3547b908 (patch) | |
tree | a8eda19c16437b4b2c19e412ba3d8a4d2adb203e /setup_native | |
parent | 2b44c6ee402ae2b96e87772a6a7bb11ddf79c136 (diff) |
deleted unread var and code in setup_native, vistaspecial.cxx
and simplified coding after that since the logic is not needed
anymore.
Diffstat (limited to 'setup_native')
-rw-r--r-- | setup_native/source/win32/customactions/shellextensions/vistaspecial.cxx | 60 |
1 files changed, 5 insertions, 55 deletions
diff --git a/setup_native/source/win32/customactions/shellextensions/vistaspecial.cxx b/setup_native/source/win32/customactions/shellextensions/vistaspecial.cxx index aede073d68d7..40ff772ff878 100644 --- a/setup_native/source/win32/customactions/shellextensions/vistaspecial.cxx +++ b/setup_native/source/win32/customactions/shellextensions/vistaspecial.cxx @@ -96,7 +96,6 @@ static BOOL RemoveCompleteDirectory( std::_tstring sPath ) { bool bDirectoryRemoved = true; - std::_tstring mystr; std::_tstring sPattern = sPath + TEXT("\\") + TEXT("*.*"); WIN32_FIND_DATA aFindData; @@ -114,9 +113,6 @@ static BOOL RemoveCompleteDirectory( std::_tstring sPath ) { std::_tstring sFileName = aFindData.cFileName; - mystr = "Current short file: " + sFileName; - // MessageBox(NULL, mystr.c_str(), "Current Content", MB_OK); - if (( strcmp(sFileName.c_str(),sCurrentDir.c_str()) != 0 ) && ( strcmp(sFileName.c_str(),sParentDir.c_str()) != 0 )) { @@ -124,31 +120,11 @@ static BOOL RemoveCompleteDirectory( std::_tstring sPath ) if ( aFindData.dwFileAttributes == FILE_ATTRIBUTE_DIRECTORY ) { - bool fSuccess = RemoveCompleteDirectory(sCompleteFileName); - if ( fSuccess ) - { - mystr = "Successfully removed content of dir " + sCompleteFileName; - // MessageBox(NULL, mystr.c_str(), "Removed Directory", MB_OK); - } - else - { - mystr = "An error occurred during removing content of " + sCompleteFileName; - // MessageBox(NULL, mystr.c_str(), "Error removing directory", MB_OK); - } + RemoveCompleteDirectory(sCompleteFileName); } else { - bool fSuccess = DeleteFile( sCompleteFileName.c_str() ); - if ( fSuccess ) - { - mystr = "Successfully removed file " + sCompleteFileName; - // MessageBox(NULL, mystr.c_str(), "Removed File", MB_OK); - } - else - { - mystr = "An error occurred during removal of file " + sCompleteFileName; - // MessageBox(NULL, mystr.c_str(), "Error removing file", MB_OK); - } + DeleteFile( sCompleteFileName.c_str() ); } } @@ -162,17 +138,9 @@ static BOOL RemoveCompleteDirectory( std::_tstring sPath ) // RemoveDirectory is only successful, if the last handle to the directory is closed // -> first removing content -> closing handle -> remove empty directory - bool fRemoveDirSuccess = RemoveDirectory(sPath.c_str()); - if ( fRemoveDirSuccess ) - { - mystr = "Successfully removed dir " + sPath; - // MessageBox(NULL, mystr.c_str(), "Removed Directory", MB_OK); - } - else + if( !( RemoveDirectory(sPath.c_str()) ) ) { - mystr = "An error occurred during removal of empty directory " + sPath; - // MessageBox(NULL, mystr.c_str(), "Error removing directory", MB_OK); bDirectoryRemoved = false; } } @@ -189,8 +157,6 @@ extern "C" UINT __stdcall RenamePrgFolder( MSIHANDLE handle ) std::_tstring sRenameSrc = sOfficeInstallPath + TEXT("program"); std::_tstring sRenameDst = sOfficeInstallPath + TEXT("program_old"); -// MessageBox(NULL, sRenameSrc.c_str(), "INSTALLLOCATION", MB_OK); - bool bSuccess = MoveFile( sRenameSrc.c_str(), sRenameDst.c_str() ); if ( !bSuccess ) { @@ -205,13 +171,6 @@ extern "C" UINT __stdcall RenamePrgFolder( MSIHANDLE handle ) } } -#if 0 - if ( !bSuccess ) - MessageBox(NULL, "Renaming folder failed", "RenamePrgFolder", MB_OK); - else - MessageBox(NULL, "Renaming folder successful", "RenamePrgFolder", MB_OK); -#endif - return ERROR_SUCCESS; } @@ -220,25 +179,16 @@ extern "C" UINT __stdcall RemovePrgFolder( MSIHANDLE handle ) std::_tstring sOfficeInstallPath = GetMsiProperty(handle, TEXT("INSTALLLOCATION")); std::_tstring sRemoveDir = sOfficeInstallPath + TEXT("program_old"); -// MessageBox(NULL, sRemoveDir.c_str(), "REMOVING OLD DIR", MB_OK); - - bool bSuccess = RemoveCompleteDirectory( sRemoveDir ); + RemoveCompleteDirectory( sRemoveDir ); TCHAR sAppend[2] = TEXT("0"); for ( int i = 0; i < 10; i++ ) { sRemoveDir = sOfficeInstallPath + TEXT("program_old") + sAppend; - bSuccess = RemoveCompleteDirectory( sRemoveDir ); + RemoveCompleteDirectory( sRemoveDir ); sAppend[0] += 1; } -#if 0 - if ( bSuccess ) - MessageBox(NULL, "Removing folder successful", "RemovePrgFolder", MB_OK); - else - MessageBox(NULL, "Removing folder failed", "RemovePrgFolder", MB_OK); -#endif - return ERROR_SUCCESS; } |