void TabView::Split(CMultiSplitPane::SPLITTYPE splitType) { std::wstring strCurrentDirectory(L""); std::shared_ptr<ConsoleView> activeConsoleView = GetActiveConsole(_T(__FUNCTION__)); if( g_settingsHandler->GetBehaviorSettings2().cloneSettings.bUseCurrentDirectory ) { strCurrentDirectory = activeConsoleView->GetConsoleHandler().GetCurrentDirectory(); } if( multisplitClass::defaultFocusPane && multisplitClass::defaultFocusPane->window ) { ConsoleViewCreate consoleViewCreate; consoleViewCreate.type = ConsoleViewCreate::CREATE; consoleViewCreate.u.userCredentials = nullptr; HWND hwndConsoleView = CreateNewConsole(&consoleViewCreate, strCurrentDirectory, wstring(L""), activeConsoleView->GetBasePriority()); if( hwndConsoleView ) { multisplitClass::SetDefaultFocusPane(multisplitClass::defaultFocusPane->split( hwndConsoleView, splitType)); CRect clientRect(0, 0, 0, 0); AdjustRectAndResize(ADJUSTSIZE_WINDOW, clientRect, WMSZ_BOTTOM); } } }
BOOL CDiskObject::CreateDirectory( const CString& directory ) /* ============================================================ Function : CDiskObject::CreateDirectory Description : Will recursively create the directory "directory". Access : Public Return : BOOL - "TRUE" if OK. "GetErrorMessage" will get an error string if "FALSE" Parameters : CString directory - directory to create Usage : Call to create a directory chain. ============================================================*/ { ClearError( ); BOOL result = TRUE; CString indir( directory ); if( indir.GetLength( ) ) { QualifyPath( indir ); _TCHAR drive[ _MAX_PATH ]; _TCHAR dir[ _MAX_DIR ]; _TCHAR fname[ _MAX_FNAME ]; _TCHAR ext[ _MAX_EXT ]; // Split directory into parts _tsplitpath( indir, drive, dir, fname, ext ); TCHAR currentDirectory[ _MAX_PATH ]; ::GetCurrentDirectory( _MAX_PATH, currentDirectory ); CStringArray directories; CString parts = dir; if( parts.GetLength( ) > 2 ) { if( parts.Left( 2 ) == _T( "\\\\" ) ) { // We have an UNC name CString strComputer; parts = parts.Right( parts.GetLength( ) - 2 ); int findDir = parts.Find( _TCHAR( '\\' ) ); if( findDir!=-1) { strComputer = _T( "\\\\" ) + parts.Left( findDir ); parts = parts.Right( parts.GetLength( ) - ( findDir + 1 ) ); } _tcscpy( drive, strComputer ); } } CString strRoot( drive ); // Strip leading \'s while( parts.GetLength( ) && parts[0] == _TCHAR( '\\' ) ) parts = parts.Right( parts.GetLength( ) - 1 ); // Cut into separate directories int find = parts.Find( _TCHAR( '\\' ) ); while( find != -1 ) { directories.Add( parts.Left( find ) ); parts = parts.Right( parts.GetLength( ) - ( find + 1 ) ); find = parts.Find( _TCHAR( '\\' ) ); } if( parts.GetLength( ) ) directories.Add( parts ); if( fname ) directories.Add( fname ); // Loop directories one-by-one, creating as necessary INT_PTR max = directories.GetSize( ); CString strCurrentDirectory( strRoot ); for( INT_PTR t = 0 ; t < max ; t++ ) { strCurrentDirectory += _TCHAR( '\\' ) + directories[ t ]; Trigger( strCurrentDirectory ); if( !( result = ::SetCurrentDirectory( strCurrentDirectory ) ) ) { if( !( result = ::CreateDirectory( strCurrentDirectory, NULL ) ) ) { SetSystemErrorMessage( ::GetLastError( ), strCurrentDirectory ); t = max; } } } ::SetCurrentDirectory( currentDirectory ); } else { SetInternalErrorMessage( ); result = FALSE; } return result; }