UnicodeString GetPersonalFolder() { UnicodeString Result; SpecialFolderLocation(CSIDL_PERSONAL, Result); if (IsWine()) { UnicodeString WineHostHome; int Len = ::GetEnvironmentVariable(L"WINE_HOST_HOME", nullptr, 0); if (Len > 0) { WineHostHome.SetLength(Len - 1); ::GetEnvironmentVariable(L"WINE_HOST_HOME", const_cast<LPWSTR>(WineHostHome.c_str()), Len); } if (!WineHostHome.IsEmpty()) { UnicodeString WineHome = L"Z:" + core::ToUnixPath(WineHostHome); if (::DirectoryExists(WineHome)) { Result = WineHome; } } else { // Should we use WinAPI GetUserName() instead? UnicodeString UserName; int Len = ::GetEnvironmentVariable(L"USERNAME", nullptr, 0); if (Len > 0) { UserName.SetLength(Len - 1); ::GetEnvironmentVariable(L"USERNAME", const_cast<LPWSTR>(UserName.c_str()), Len); } if (!UserName.IsEmpty()) { UnicodeString WineHome = L"Z:\\home\\" + UserName; if (::DirectoryExists(WineHome)) { Result = WineHome; } } } } return Result; }
//--------------------------------------------------------------------------- void __fastcall TGUIConfiguration::Default() { TConfiguration::Default(); // reset before call to DefaultLocalized() FDefaultCopyParam.Default(); FCopyParamListDefaults = true; DefaultLocalized(); FIgnoreCancelBeforeFinish = TDateTime(0, 0, 3, 0); FContinueOnError = false; FConfirmCommandSession = true; FSynchronizeParams = TTerminal::spNoConfirmation | TTerminal::spPreviewChanges; FSynchronizeModeAuto = -1; FSynchronizeMode = TTerminal::smRemote; FMaxWatchDirectories = 500; FSynchronizeOptions = soRecurse | soSynchronizeAsk; FQueueTransfersLimit = 2; FQueueKeepDoneItems = true; FQueueKeepDoneItemsFor = 15; FQueueAutoPopup = true; FSessionRememberPassword = false; UnicodeString ProgramsFolder; SpecialFolderLocation(CSIDL_PROGRAM_FILES, ProgramsFolder); FDefaultPuttyPathOnly = IncludeTrailingBackslash(ProgramsFolder) + L"PuTTY\\" + OriginalPuttyExecutable; FDefaultPuttyPath = L"%PROGRAMFILES%\\PuTTY\\" + OriginalPuttyExecutable; FPuttyPath = FormatCommand(FDefaultPuttyPath, L""); PSftpPath = FormatCommand(L"%PROGRAMFILES%\\PuTTY\\psftp.exe", L""); FPuttyPassword = false; FTelnetForFtpInPutty = true; FPuttySession = L"WinSCP temporary session"; FBeepOnFinish = false; FBeepOnFinishAfter = TDateTime(0, 0, 30, 0); FCopyParamCurrent = L""; FKeepUpToDateChangeDelay = 500; FChecksumAlg = L"md5"; FSessionReopenAutoIdle = 9000; FNewDirectoryProperties.Default(); FNewDirectoryProperties.Rights = TRights::rfDefault | TRights::rfExec; }