bool CTestResource::SaveToDirectory (LPCTSTR pszDir) { bool rc=false; ENTERCRITICAL; { // Delete all the files under directory "pszDir" void *pHandle; TCHAR szOrigDir[256]; _tgetcwd(szOrigDir,sizeof szOrigDir-1); if(0==_tchdir(pszDir)){ String strFile; for(bool b=CeCosTestUtils::StartSearch(pHandle,strFile);b;b=CeCosTestUtils::NextFile(pHandle,strFile)){ if(CeCosTestUtils::IsFile(strFile)){ _tunlink(strFile); } } CeCosTestUtils::EndSearch(pHandle); rc=true; for(CTestResource *pResource=pFirstInstance;pResource;pResource=pResource->m_pNextInstance){ CTestResourceProperties prop(pResource); rc&=prop.SaveToFile(pResource->FileName()); } } else { fprintf(stderr,"Failed to change to %s from %s\n",pszDir,szOrigDir); } _tchdir(szOrigDir); } LEAVECRITICAL; return rc; }
bool CTestResource::LoadFromDirectory (LPCTSTR psz) { bool rc=true; ENTERCRITICAL; DeleteAllInstances(); // Find all the files in directory "psz" and load from each of them TCHAR szOrigDir[256]; _tgetcwd(szOrigDir,sizeof szOrigDir-1); if(0==_tchdir(psz)){ String strFile; void *pHandle; for(bool b=CeCosTestUtils::StartSearch(pHandle,strFile);b;b=CeCosTestUtils::NextFile(pHandle,strFile)){ if(CeCosTestUtils::IsFile(strFile)){ CTestResource *pResource=new CTestResource(_T(""),_T("")); CTestResourceProperties prop(pResource); prop.LoadFromFile(strFile); } } CeCosTestUtils::EndSearch(pHandle); } else { TRACE(_T("Failed to change to %s from %s\n"),psz,szOrigDir); } _tchdir(szOrigDir); LEAVECRITICAL; return rc; }
bool CeCosTestPlatform::LoadFromDir(LPCTSTR pszDir) { bool rc=true; TRACE(_T("CeCosTestPlatform::LoadFromDir %s\n"),pszDir); // Find all the files in directory pszDir and load from each of them TCHAR szOrigDir[256]; _tgetcwd(szOrigDir,sizeof szOrigDir-1); if(0==_tchdir(pszDir)){ String strFile; void *pHandle; for(bool b=CeCosTestUtils::StartSearch(pHandle,strFile);b;b=CeCosTestUtils::NextFile(pHandle,strFile)){ if(CeCosTestUtils::IsFile(strFile)){ CeCosTestPlatform t; t.m_strName=strFile; CeCosTestPlatformProperties prop(&t); if(prop.LoadFromFile(strFile)){ Add(t); } else { ERROR(_T("Illegal platform specification in %s%c%s\n"),pszDir,cPathsep,(LPCTSTR)strFile); rc=false; } } } CeCosTestUtils::EndSearch(pHandle); } else { ERROR(_T("Failed to change to %s from %s\n"),pszDir,szOrigDir); } _tchdir(szOrigDir); return rc; }
int directory_exists(const TCHAR* filename) { TCHAR* save = get_current_dir(); if(_tchdir(filename)) { _tchdir(save); free(save); return 1; } else { return 0; } }
bool FolderExists(const KString& FolderName) { if(FolderName.IsEmpty()) return false; TCHAR CurDir[1024]; _tgetcwd(CurDir, sizeof(CurDir) - 1); const bool bResult = _tchdir(UnslashedFolderName(FolderName)) ? false : true; _tchdir(CurDir); return bResult; }
static void setup_testenv(void **state) { int rc; rc = wipe_testdir(); assert_int_equal(rc, 0); mbchar_t *dir = c_utf8_path_to_locale(CSYNC_TEST_DIR); rc = _tmkdir(dir, MKDIR_MASK); assert_int_equal(rc, 0); assert_non_null(_tgetcwd(wd_buffer, WD_BUFFER_SIZE)); rc = _tchdir(dir); assert_int_equal(rc, 0); c_free_locale_string(dir); /* --- initialize csync */ statevar *mystate = malloc( sizeof(statevar) ); mystate->result = NULL; csync_create(&(mystate->csync), "/tmp/csync1", "/tmp/csync2"); mystate->csync->replica = LOCAL_REPLICA; *state = mystate; }
bool CeCosTestPlatform::SaveToDir (LPCTSTR pszDir) { bool rc=false; void *pHandle; TCHAR szOrigDir[256]; _tgetcwd(szOrigDir,sizeof szOrigDir-1); if(0==_tchdir(pszDir)){ // Delete all the files under directory "pszDir" String strFile; for(bool b=CeCosTestUtils::StartSearch(pHandle,strFile);b;b=CeCosTestUtils::NextFile(pHandle,strFile)){ if(CeCosTestUtils::IsFile(strFile)){ _tunlink(strFile); } } CeCosTestUtils::EndSearch(pHandle); rc=true; // Rewrite the files for(int i=0;i<(signed)arPlatforms.size();i++){ CeCosTestPlatform &t=arPlatforms[i]; CeCosTestPlatformProperties prop(&t); rc&=prop.SaveToFile(t.Name()); } } else { ERROR(_T("Failed to change to %s from %s\n"),pszDir,szOrigDir); } return rc; }
BOOL SetRootPath(TCHAR *oldpath, TCHAR *InPath) { TCHAR OutPath[MAX_PATH]; TCHAR OutPathTemp[MAX_PATH]; /* Retrieve the full path name from the (possibly relative) InPath */ if (GetFullPathName(InPath, MAX_PATH, OutPathTemp, NULL) == 0) goto Fail; /* Convert the full path to its correct case. * Example: c:\windows\SYSTEM32 => C:\WINDOWS\System32 */ GetPathCase(OutPathTemp, OutPath); /* Use _tchdir, since unlike SetCurrentDirectory it updates * the current-directory-on-drive environment variables. */ if (_tchdir(OutPath) != 0) goto Fail; /* Keep original drive in ordinary CD/CHDIR (without /D switch). */ if (oldpath != NULL && _tcsncicmp(OutPath, oldpath, 2) != 0) SetCurrentDirectory(oldpath); return TRUE; Fail: ConErrFormatMessage(GetLastError()); nErrorLevel = 1; return FALSE; }
BOOL SetRootPath(TCHAR *oldpath, TCHAR *InPath) { TCHAR OutPath[MAX_PATH]; TCHAR OutPathTemp[MAX_PATH]; /* The use of both of these together will correct the case of a path where as one alone or GetFullPath will not. Exameple: c:\windows\SYSTEM32 => C:\WINDOWS\system32 */ if (GetFullPathName(InPath, MAX_PATH, OutPathTemp, NULL)) { GetPathCase(OutPathTemp, OutPath); /* Use _tchdir, since unlike SetCurrentDirectory it updates * the current-directory-on-drive environment variables. */ if (_tchdir(OutPath) != 0) { ConErrFormatMessage(GetLastError()); nErrorLevel = 1; return FALSE; } /* Keep original drive in ordinary CD/CHDIR (without /D switch). */ if (oldpath != NULL && _tcsncicmp(OutPath, oldpath, 2) != 0) SetCurrentDirectory(oldpath); } return TRUE; }
int LoadDatabaseModule(void) { TCHAR szProfile[MAX_PATH]; PathToAbsoluteT(_T("."), szProfile); _tchdir(szProfile); szProfile[0] = 0; LoadDatabaseServices(); // find out which profile to load if (!getProfile(szProfile, SIZEOF(szProfile))) return 1; EnsureCheckerLoaded(false); // unload dbchecker if (arDbPlugins.getCount() == 0) { TCHAR buf[256]; TCHAR* p = _tcsrchr(szProfile, '\\'); mir_sntprintf(buf, SIZEOF(buf), TranslateT("Miranda is unable to open '%s' because you do not have any profile plugins installed.\nYou need to install dbx_mmap.dll"), p ? ++p : szProfile); MessageBox(0, buf, TranslateT("No profile support installed!"), MB_OK | MB_ICONERROR); } // find a driver to support the given profile bool retry; int rc; do { retry = false; if ( _taccess(szProfile, 0) && shouldAutoCreate(szProfile)) rc = tryCreateDatabase(szProfile); else rc = tryOpenDatabase(szProfile); if (rc > 0) { // if there were drivers but they all failed cos the file is locked, try and find the miranda which locked it if (fileExist(szProfile)) { // file isn't locked, just no driver could open it. TCHAR buf[256]; TCHAR* p = _tcsrchr(szProfile, '\\'); mir_sntprintf(buf, SIZEOF(buf), TranslateT("Miranda was unable to open '%s', it's in an unknown format.\nThis profile might also be damaged, please run DbChecker which should be installed."), p ? ++p : szProfile); MessageBox(0, buf, TranslateT("Miranda can't understand that profile"), MB_OK | MB_ICONERROR); } else if (!FindMirandaForProfile(szProfile)) { TCHAR buf[256]; TCHAR* p = _tcsrchr(szProfile, '\\'); mir_sntprintf(buf, SIZEOF(buf), TranslateT("Miranda was unable to open '%s'\nIt's inaccessible or used by other application or Miranda instance"), p ? ++p : szProfile); retry = MessageBox(0, buf, TranslateT("Miranda can't open that profile"), MB_RETRYCANCEL | MB_ICONERROR) == IDRETRY; } } } while (retry); if (rc == ERROR_SUCCESS) { InitIni(); return 0; } return rc; }
BOOL CTeapotApp::InitWorkDir(const _TCHAR* dir) { _TCHAR* oldDir = _tgetcwd(0, 0); if (oldDir == 0) return FALSE; m_OldWorkDir = oldDir; free(oldDir); return (_tchdir(dir) == 0); }
int LoadDatabaseModule(void) { TCHAR szProfile[MAX_PATH]; pathToAbsoluteT(_T("."), szProfile, NULL); _tchdir(szProfile); szProfile[0] = 0; // load the older basic services of the db InitUtils(); // find out which profile to load if ( !getProfile( szProfile, SIZEOF( szProfile ))) return 1; PLUGIN_DB_ENUM dbe; dbe.cbSize = sizeof(PLUGIN_DB_ENUM); dbe.lParam = (LPARAM)szProfile; if ( _taccess(szProfile, 0) && shouldAutoCreate( szProfile )) dbe.pfnEnumCallback=( int(*) (const char*,void*,LPARAM) )FindDbPluginAutoCreate; else dbe.pfnEnumCallback=( int(*) (const char*,void*,LPARAM) )FindDbPluginForProfile; // find a driver to support the given profile int rc = CallService(MS_PLUGINS_ENUMDBPLUGINS, 0, (LPARAM)&dbe); switch ( rc ) { case -1: { // no plugins at all TCHAR buf[256]; TCHAR* p = _tcsrchr(szProfile,'\\'); mir_sntprintf(buf,SIZEOF(buf),TranslateT("Miranda is unable to open '%s' because you do not have any profile plugins installed.\nYou need to install dbx_3x.dll or equivalent."), p ? ++p : szProfile ); MessageBox(0,buf,TranslateT("No profile support installed!"),MB_OK | MB_ICONERROR); break; } case 1: // if there were drivers but they all failed cos the file is locked, try and find the miranda which locked it if (fileExist(szProfile)) { // file isn't locked, just no driver could open it. TCHAR buf[256]; TCHAR* p = _tcsrchr(szProfile,'\\'); mir_sntprintf(buf,SIZEOF(buf),TranslateT("Miranda was unable to open '%s', it's in an unknown format.\nThis profile might also be damaged, please run DB-tool which should be installed."), p ? ++p : szProfile); MessageBox(0,buf,TranslateT("Miranda can't understand that profile"),MB_OK | MB_ICONERROR); } else if (!FindMirandaForProfile(szProfile)) { TCHAR buf[256]; TCHAR* p = _tcsrchr(szProfile,'\\'); mir_sntprintf(buf,SIZEOF(buf),TranslateT("Miranda was unable to open '%s'\nIt's inaccessible or used by other application or Miranda instance"), p ? ++p : szProfile); MessageBox(0,buf,TranslateT("Miranda can't open that profile"),MB_OK | MB_ICONERROR); } break; } return (rc != 0); }
void MyLib::ImportLycByPath(std::tstring path) { LPCTSTR pszFolder=path.c_str(); TCHAR* curPath=new TCHAR[MAX_PATH]; _tgetcwd(curPath,MAX_PATH); //改变当前目录 _tchdir(pszFolder); BOOL findResult=FALSE; WIN32_FIND_DATA findFileData; HANDLE hFind; hFind=::FindFirstFile(_T("*.lrc"),&findFileData); if(hFind!=INVALID_HANDLE_VALUE){ findResult=TRUE; while(findResult) { TCHAR *_findName=new TCHAR[MAX_PATH]; _tcscpy(_findName,findFileData.cFileName); TCHAR *pathName=new TCHAR[MAX_PATH+1]; _tcscpy(pathName,pszFolder); _tcscat(pathName,_T("\\")); _tcscat(pathName,_findName); //std::tstring str(pathName); std::tstring str(pathName); MyLib::shared()->dataPaths.push_back(str); findResult=FindNextFile(hFind,&findFileData); } FindClose(hFind); } //回复当前目录 _tchdir(curPath); }
void GetProfileDirectory(TCHAR* szMirandaDir, TCHAR* szPath, int cbPath) { TCHAR szProfileDir[MAX_PATH], szExpandedProfileDir[MAX_PATH], szMirandaBootIni[MAX_PATH]; lstrcpy(szMirandaBootIni,szMirandaDir); lstrcat(szMirandaBootIni,_T("\\mirandaboot.ini")); GetPrivateProfileString(_T("Database"),_T("ProfileDir"),_T("./Profiles"),szProfileDir,SIZEOF(szProfileDir),szMirandaBootIni); ExpandEnvironmentStrings(szProfileDir,szExpandedProfileDir,SIZEOF(szExpandedProfileDir)); _tchdir(szMirandaDir); if(!_tfullpath(szPath,szExpandedProfileDir,cbPath)) lstrcpyn(szPath,szMirandaDir,cbPath); if(szPath[lstrlen(szPath)-1]=='\\') szPath[lstrlen(szPath)-1] = 0; }
/* * popd command */ INT CommandPopd (LPTSTR rest) { INT ret = 0; if (!_tcsncmp(rest, _T("/?"), 2)) { ConOutResPuts(STRING_DIRSTACK_HELP2); return 0; } if (nStackDepth == 0) return 1; ret = _tchdir(lpStackTop->szPath) != 0; PopDirectory (); return ret; }
static void teardown(void **state) { statevar *sv = (statevar*) *state; CSYNC *csync = sv->csync; int rc; output("================== Tearing down!\n"); rc = csync_destroy(csync); assert_int_equal(rc, 0); rc = _tchdir(wd_buffer); assert_int_equal(rc, 0); rc = wipe_testdir(); assert_int_equal(rc, 0); *state = NULL; }
bool DeleteFolder(const KString& FolderName, bool bRecursive, bool bSafe) { if(!CleanFolder(FolderName, bRecursive, bSafe)) return false; if(!GetCurrentFolder().CollateNoCase(SlashedFolderName(FolderName))) _tchdir(TEXT("..")); if(_trmdir(UnslashedFolderName(FolderName))) { if(!bSafe) { INITIATE_DEFINED_CODE_FAILURE( (KString)TEXT("Error deleteing folder \"") + FolderName + TEXT("\""), errno); } return false; } return true; }
int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPTSTR lpstrCmdLine, int nCmdShow) { //MessageBox(NULL, lpstrCmdLine, "Command line", MB_OK); HRESULT hRes = ::CoInitialize(NULL); // If you are running on NT 4.0 or higher you can use the following call instead to // make the EXE free threaded. This means that calls come in on a random RPC thread. // HRESULT hRes = ::CoInitializeEx(NULL, COINIT_MULTITHREADED); ATLASSERT(SUCCEEDED(hRes)); // this resolves ATL window thunking problem when Microsoft Layer for Unicode (MSLU) is used ::DefWindowProc(NULL, 0, 0, 0L); AtlInitCommonControls(ICC_BAR_CLASSES); // add flags to support other controls hRes = _Module.Init(NULL, hInstance); ATLASSERT(SUCCEEDED(hRes)); // don't allow multiple instances, wait for previous to terminate HANDLE mutex = ::CreateMutex(NULL, TRUE, _T("MoleculesInitMTX")); if(mutex && ::GetLastError() == ERROR_ALREADY_EXISTS) { DWORD state = WaitForSingleObject(mutex, 500); if(state == WAIT_TIMEOUT || state == WAIT_FAILED) { _Module.Term(); ::CoUninitialize(); return 0; } } // find out where our binary (.scr) is located // this is used to locate molecules folder later std::unique_ptr<TCHAR[]> mod(new TCHAR[MAX_PATH]); ::GetModuleFileName(NULL, mod.get(), MAX_PATH-1); *(_tcsrchr(mod.get(), '\\')+1) = '\0'; TCHAR drive; if(islower((int)mod[0])) drive = _toupper(mod[0]); else drive = mod[0]; int drv = (int)drive-64; _chdrive(drv); _tchdir(mod.get()); int nRet = 0; TCHAR szTokens[] = _T("-/"); HWND hwndParent = NULL; // check reason for a call ECallReason cr = eSettings; // when no parameter given, show settings LPCTSTR lpszToken = _Module.FindOneOf(::GetCommandLine(), szTokens); if (lpszToken != NULL) { // XXX this flag is no longer used by windows? //if(_tcsnicmp(lpszToken, _T("c"), 1) == 0) //{ // settings (configuration dialog) // cr = eSettings; // hwndParent = GetForegroundWindow(); //} if(_tcsnicmp(lpszToken, _T("p "), 2) == 0) { // preview cr = ePreview; int n = 0; _stscanf_s(lpszToken+1, _T("%i%n"), &hwndParent, &n); lpszToken += n+1; } else if(_tcsnicmp(lpszToken, _T("s"), 1) == 0) { // normal screen saver mode cr = eRun; } // lpszToken = _Module.FindOneOf(lpszToken, szTokens); } switch (cr) { default: case eRun: nRet = Run(lpstrCmdLine, nCmdShow); break; case ePreview: nRet = Preview(hwndParent); break; case eSettings: #ifdef DEBUG // in debug builds run saver instead of settings when launched nRet = Run(lpstrCmdLine, nCmdShow); #else nRet = Settings(hwndParent); #endif break; } _Module.Term(); ::CoUninitialize(); return nRet; }
void CPlayerView::AddToPlayList( const CString& strFileName ) { CString strExt( strFileName ); CString strDir( strFileName ); CString strCurrentDir; int nPos; nPos = strExt.ReverseFind( '.' ); if ( nPos > 0 ) { strExt = strExt.Mid( nPos + 1 ); } nPos = strDir.ReverseFind( _T( '\\' ) ); if ( nPos > 0 ) { strDir = strDir.Left( nPos ); } char lpszCurDir[ MAX_PATH + 1 ] = {'\0',}; // Get current directory _getcwd( lpszCurDir, sizeof( lpszCurDir ) ); if ( 0 == strExt.CompareNoCase( _T( "M3U" ) ) ) { // go to the directory if ( 0 == _tchdir( strDir ) ) { // open the playlist FILE* pFile = CDexOpenFile( CUString( strFileName ), _W( "rt" ) ); if ( NULL != pFile ) { char lpszLine[ 8192 ] = {'\0',}; // read the lines in the playlist file while ( NULL != fgets( lpszLine, sizeof( lpszLine ), pFile ) ) { if ( '\n' == lpszLine[ strlen( lpszLine ) -1 ] ) { lpszLine[ strlen( lpszLine ) -1 ] = '\0'; } // skip extended info if ( '#' != lpszLine[0] ) { CString strEntry( lpszLine ); int nPos = 0; if ( strDir.Find( _T( ":\\" ) ) < 0 ) { if ( 0 == ( nPos = strEntry.Find( _T( ".\\" ) ) ) ) { strEntry = strDir + strEntry.Mid( 1 ); } else { strEntry = strDir + _T( "\\" ) + strEntry; } } AddStringToPlayList( strEntry ); } } // close the playlist file fclose( pFile ); } } } else if ( 0 == strExt.CompareNoCase( _T( "PLS" ) ) ) { CIni plsIni; int nNumEntries = 0; CString strEntry; CString strNumber; int i = 0; // go to the directory if ( 0 == _tchdir( strDir ) ) { plsIni.SetIniFileName( CUString( strFileName ) ); nNumEntries = plsIni.GetValue( _T( "playlist" ), _T( "NumberOfEntries" ), nNumEntries ); for ( i = 1; i <= nNumEntries; i++ ) { strNumber.Format( _T( "File%d"), i ); strEntry = plsIni.GetValue( CUString( _W( "playlist" ) ), CUString( strNumber ), _W( "" ) ); if ( !strEntry.IsEmpty() ) { int nPos = 0; if ( strDir.Find( _T( ":\\" ) ) < 0 ) { if ( 0 == ( nPos = strEntry.Find( _T( ".\\" ) ) ) ) { strEntry = strDir + strEntry.Mid( 1 ); } else { strEntry = strDir + _T( "\\" ) + strEntry; } } AddStringToPlayList( strEntry ); } } } } else { AddStringToPlayList( strFileName ); } // switch back to the current directory chdir( lpszCurDir ); }
int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow) { TCHAR basedir[LAUNCHER_MAXPATH] = {0}; TCHAR java[LAUNCHER_MAXPATH] = {0}; TCHAR appFolder[LAUNCHER_MAXPATH] = {0}; TCHAR java_escaped[LAUNCHER_MAXPATH] = {0}; TCHAR jar[LAUNCHER_MAXPATH] = {0}; LPTSTR *szArgList; int argCount; // Parse command line arguments to see if /Debug is there szArgList = CommandLineToArgvW(GetCommandLine(), &argCount); // [RT-31061] otherwise UI can be left in back of other windows AllowSetForegroundWindow(ASFW_ANY); enableDebugIfNeeded(argCount, szArgList); if (isDebug) { AllocConsole(); SetConsoleOutputCP(CP_UTF8); } if (GetModuleFileNameW(NULL, basedir, LAUNCHER_MAXPATH) != 0) { TCHAR *end = _tcsrchr(basedir, '\\'); if (end != NULL) { *end = 0; if (!getMainJar(basedir, jar, LAUNCHER_MAXPATH)) { showError( (jar[0] == 0) ? _T("Failed to parse package configuration file") : jar, _T("Failed to find main application jar!")); return -1; } getAppFolder(basedir, appFolder, LAUNCHER_MAXPATH); //DO Launch //this will concatenate arguments using space, // we need to make sure spaces are properly escaped if we have any _tchdir(appFolder); if (!startJVM(basedir, appFolder, jar, argCount, szArgList)) { showError(_T("Failed to launch JVM"), NULL); return -1; } } } if (szArgList != NULL) { LocalFree(szArgList); } if (isDebug) { showError(_T("Exiting application"), NULL); } return 1; }
// NOTE: 进入 ExitInstance 前, m_pMainWnd 窗口对象已被释放掉了 int CTeapotApp::ExitInstance() { _tchdir(m_OldWorkDir); // 恢复旧的工作目录 CWinApp::ExitInstance(); return m_ExitCode; }
bool pws_os::chdir(const stringT &dir) { ASSERT(!dir.empty()); return (_tchdir(dir.c_str()) == 0); }
bool ZipPlatform::ChangeDirectory(LPCTSTR lpDirectory) { return _tchdir(lpDirectory) == 0; // returns 0 if ok }
///////////////////////////////////////////////////////////////////// // // Function: // // Description: // ///////////////////////////////////////////////////////////////////// UINT CACreateProjectInitFile::OnExecution() { tstring strSetupExeName; tstring strDataDirectory; tstring strProjectInitUrl; tstring strProjectInitName; tstring strProjectInitTeamName; tstring strProjectInitAuthenticator; tstring strProjectInitSetupCookie; PROJECT_INIT pi; UINT uiReturnValue = -1; uiReturnValue = GetProperty( _T("DATADIR"), strDataDirectory ); if ( uiReturnValue ) return uiReturnValue; uiReturnValue = GetProperty( _T("PROJINIT_URL"), strProjectInitUrl ); if ( uiReturnValue ) return uiReturnValue; uiReturnValue = GetProperty( _T("PROJINIT_AUTH"), strProjectInitAuthenticator ); if ( uiReturnValue ) return uiReturnValue; uiReturnValue = GetProperty( _T("PROJINIT_TEAMNAME"), strProjectInitTeamName ); if ( uiReturnValue ) return uiReturnValue; uiReturnValue = GetProperty( _T("SETUPEXENAME"), strSetupExeName ); if ( uiReturnValue ) return uiReturnValue; LogMessage( INSTALLMESSAGE_INFO, NULL, NULL, NULL, NULL, _T("Changing to the data directory") ); _tchdir(strDataDirectory.c_str()); if (!strProjectInitUrl.empty()) { LogMessage( INSTALLMESSAGE_INFO, NULL, NULL, NULL, NULL, _T("Detected command line parameters") ); pi.init(); strncpy(pi.url, CW2A(strProjectInitUrl.c_str()), sizeof(pi.url)-1); strncpy(pi.name, CW2A(strProjectInitUrl.c_str()), sizeof(pi.name)-1); strncpy(pi.account_key, CW2A(strProjectInitAuthenticator.c_str()), sizeof(pi.account_key)-1); strncpy(pi.team_name, CW2A(strProjectInitTeamName.c_str()), sizeof(pi.team_name)-1); pi.embedded = false; pi.write(); } else { LogMessage( INSTALLMESSAGE_INFO, NULL, NULL, NULL, NULL, _T("Checking for file name parameters") ); strProjectInitUrl = ParseParameter(strSetupExeName, tstring(_T("amu"))); strProjectInitName = ParseParameter(strSetupExeName, tstring(_T("an"))); strProjectInitAuthenticator = ParseParameter(strSetupExeName, tstring(_T("aa"))); strProjectInitSetupCookie = ParseParameter(strSetupExeName, tstring(_T("asc"))); if (!strProjectInitUrl.empty() || !strProjectInitName.empty() || !strProjectInitAuthenticator.empty() || !strProjectInitSetupCookie.empty()) { LogMessage( INSTALLMESSAGE_INFO, NULL, NULL, NULL, NULL, _T("Detected file name parameters") ); pi.init(); if (!strProjectInitUrl.empty()) { LogMessage( INSTALLMESSAGE_INFO, NULL, NULL, NULL, NULL, _T("Detected project url") ); strncpy(pi.url, CW2A(strProjectInitUrl.c_str()), sizeof(pi.url)-1); pi.embedded = false; } if (!strProjectInitName.empty()) { LogMessage( INSTALLMESSAGE_INFO, NULL, NULL, NULL, NULL, _T("Detected project name") ); strncpy(pi.name, CW2A(strProjectInitName.c_str()), sizeof(pi.name)-1); } if (!strProjectInitAuthenticator.empty()) { LogMessage( INSTALLMESSAGE_INFO, NULL, NULL, NULL, NULL, _T("Detected project authenticator") ); strncpy(pi.account_key, CW2A(strProjectInitAuthenticator.c_str()), sizeof(pi.account_key)-1); } if (!strProjectInitSetupCookie.empty()) { LogMessage( INSTALLMESSAGE_INFO, NULL, NULL, NULL, NULL, _T("Detected setup cookie") ); strncpy(pi.setup_cookie, CW2A(strProjectInitSetupCookie.c_str()), sizeof(pi.setup_cookie)-1); } pi.write(); } } return ERROR_SUCCESS; }