Annotation of truecrypt/main/application.cpp, revision 1.1

1.1     ! root        1: /*
        !             2:  Copyright (c) 2008 TrueCrypt Foundation. All rights reserved.
        !             3: 
        !             4:  Governed by the TrueCrypt License 2.4 the full text of which is contained
        !             5:  in the file License.txt included in TrueCrypt binary and source code
        !             6:  distribution packages.
        !             7: */
        !             8: 
        !             9: #include "System.h"
        !            10: #include <wx/stdpaths.h>
        !            11: #include "Main.h"
        !            12: #include "Application.h"
        !            13: #include "CommandLineInterface.h"
        !            14: #include "GraphicUserInterface.h"
        !            15: #include "TextUserInterface.h"
        !            16: 
        !            17: namespace TrueCrypt
        !            18: {
        !            19:        wxApp* Application::CreateConsoleApp ()
        !            20:        {
        !            21:                mUserInterface = new TextUserInterface;
        !            22:                return mUserInterface;
        !            23:        } 
        !            24: 
        !            25:        wxApp* Application::CreateGuiApp ()
        !            26:        {
        !            27:                mUserInterface = new GraphicUserInterface;
        !            28:                return mUserInterface;
        !            29:        } 
        !            30: 
        !            31:        FilePath Application::GetConfigFilePath (const wxString &configFileName, bool createConfigDir)
        !            32:        {
        !            33:                wxStandardPaths stdPaths;
        !            34:                DirectoryPath configDir;
        !            35:                
        !            36:                if (!Core->IsInTravelMode())
        !            37:                {
        !            38: #ifdef TC_MACOSX
        !            39:                        wxFileName configPath (L"~/Library/Application Support/TrueCrypt");
        !            40:                        configPath.Normalize();
        !            41:                        configDir = wstring (configPath.GetFullPath());
        !            42: #else
        !            43:                        configDir = wstring (stdPaths.GetUserDataDir());
        !            44: #endif
        !            45:                }
        !            46:                else
        !            47:                        configDir = GetExecutableDirectory();
        !            48: 
        !            49:                if (createConfigDir && !configDir.IsDirectory())
        !            50:                        Directory::Create (configDir);
        !            51: 
        !            52:                FilePath filePath = wstring (wxFileName (wstring (configDir), configFileName).GetFullPath());
        !            53:                return filePath;
        !            54:        }
        !            55: 
        !            56:        DirectoryPath Application::GetExecutableDirectory ()
        !            57:        {
        !            58:                return wstring (wxFileName (wxStandardPaths().GetExecutablePath()).GetPath());
        !            59:        }
        !            60: 
        !            61:        FilePath Application::GetExecutablePath ()
        !            62:        {
        !            63:                return wstring (wxStandardPaths().GetExecutablePath());
        !            64:        }
        !            65: 
        !            66:        void Application::Initialize (UserInterfaceType::Enum type)
        !            67:        {
        !            68:                switch (type)
        !            69:                {
        !            70:                case UserInterfaceType::Text:
        !            71:                        {
        !            72:                                wxAppInitializer wxTheAppInitializer((wxAppInitializerFunction) CreateConsoleApp);
        !            73:                                break;
        !            74:                        }
        !            75:                case UserInterfaceType::Graphic:
        !            76:                        {
        !            77:                                wxAppInitializer wxTheAppInitializer((wxAppInitializerFunction) CreateGuiApp);
        !            78:                                break;
        !            79:                        }
        !            80: 
        !            81:                default:
        !            82:                        throw ParameterIncorrect (SRC_POS);
        !            83:                }
        !            84:        }
        !            85: 
        !            86:        int Application::ExitCode = 0;
        !            87:        UserInterface *Application::mUserInterface = nullptr;
        !            88: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.