Back to index

lightning-sunbird  0.9+nobinonly
nsInstallFolder.h
Go to the documentation of this file.
00001 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
00002 /* ***** BEGIN LICENSE BLOCK *****
00003  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Mozilla Public License Version
00006  * 1.1 (the "License"); you may not use this file except in compliance with
00007  * the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * The Original Code is Mozilla Communicator client code, released
00016  * March 31, 1998.
00017  *
00018  * The Initial Developer of the Original Code is
00019  * Netscape Communications Corporation.
00020  * Portions created by the Initial Developer are Copyright (C) 1998
00021  * the Initial Developer. All Rights Reserved.
00022  *
00023  * Contributor(s):
00024  *   Daniel Veditz <dveditz@netscape.com>
00025  *   Douglas Turner <dougt@netscape.com>
00026  *
00027  * Alternatively, the contents of this file may be used under the terms of
00028  * either of the GNU General Public License Version 2 or later (the "GPL"),
00029  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00030  * in which case the provisions of the GPL or the LGPL are applicable instead
00031  * of those above. If you wish to allow use of your version of this file only
00032  * under the terms of either the GPL or the LGPL, and not to allow others to
00033  * use your version of this file under the terms of the MPL, indicate your
00034  * decision by deleting the provisions above and replace them with the notice
00035  * and other provisions required by the GPL or the LGPL. If you do not delete
00036  * the provisions above, a recipient may use your version of this file under
00037  * the terms of any one of the MPL, the GPL or the LGPL.
00038  *
00039  * ***** END LICENSE BLOCK ***** */
00040 
00041 
00042 #ifndef __NS_INSTALLFOLDER_H__
00043 #define __NS_INSTALLFOLDER_H__
00044 
00045 #include "nscore.h"
00046 #include "prtypes.h"
00047 
00048 #include "nsString.h"
00049 
00050 #define PLUGIN_DIR                         100
00051 #define PROGRAM_DIR                        101
00052 
00053 #define TEMP_DIR                           104
00054 #define OS_HOME_DIR                        105
00055 #define PROFILE_DIR                        106
00056 #define PREFERENCES_DIR                    107
00057 #define OS_DRIVE                           108
00058 #define FILE_TARGET                        109
00059 
00060 #define COMPONENTS_DIR                     110
00061 #define CHROME_DIR                         111
00062 
00063 #define WIN_SYS_DIR                        200
00064 #define WINDOWS_DIR                        201
00065 #define WIN_DESKTOP_DIR                    202
00066 #define WIN_DESKTOP_COMMON                 203
00067 #define WIN_STARTMENU                      204
00068 #define WIN_STARTMENU_COMMON               205
00069 #define WIN_PROGRAMS_DIR                   206
00070 #define WIN_PROGRAMS_COMMON                207
00071 #define WIN_STARTUP_DIR                    208
00072 #define WIN_STARTUP_COMMON                 209
00073 #define WIN_APPDATA_DIR                    210
00074 #define WIN_PROGRAM_FILES                  211
00075 #define WIN_COMMON_FILES                   212
00076 
00077 #define MAC_SYSTEM                         300
00078 #define MAC_DESKTOP                        301
00079 #define MAC_TRASH                          302
00080 #define MAC_STARTUP                        303
00081 #define MAC_SHUTDOWN                       304
00082 #define MAC_APPLE_MENU                     305
00083 #define MAC_CONTROL_PANEL                  306
00084 #define MAC_EXTENSION                      307
00085 #define MAC_FONTS                          308
00086 #define MAC_PREFERENCES                    309
00087 #define MAC_DOCUMENTS                      310
00088 
00089 #define MACOSX_HOME                        500
00090 #define MACOSX_DEFAULT_DOWNLOAD            501
00091 #define MACOSX_USER_DESKTOP                502
00092 #define MACOSX_LOCAL_DESKTOP               503
00093 #define MACOSX_USER_APPLICATIONS           504
00094 #define MACOSX_LOCAL_APPLICATIONS          505
00095 #define MACOSX_USER_DOCUMENTS              506
00096 #define MACOSX_LOCAL_DOCUMENTS             507
00097 #define MACOSX_USER_INTERNET_PLUGIN        508
00098 #define MACOSX_LOCAL_INTERNET_PLUGIN       509
00099 #define MACOSX_USER_FRAMEWORKS             510
00100 #define MACOSX_LOCAL_FRAMEWORKS            511
00101 #define MACOSX_USER_PREFERENCES            512
00102 #define MACOSX_LOCAL_PREFERENCES           513
00103 #define MACOSX_PICTURE_DOCUMENTS           514
00104 #define MACOSX_MOVIE_DOCUMENTS             515
00105 #define MACOSX_MUSIC_DOCUMENTS             516
00106 #define MACOSX_INTERNET_SITES              517
00107 
00108 #define UNIX_LOCAL                         400
00109 #define UNIX_LIB                           401
00110 
00111 #ifdef XP_MAC
00112 #define INSTALL_PLUGINS_DIR     NS_LITERAL_CSTRING("Plug-ins")
00113 #define INSTALL_COMPONENTS_DIR  NS_LITERAL_CSTRING("Components")
00114 #define INSTALL_CHROME_DIR      NS_LITERAL_CSTRING("Chrome")
00115 #else
00116 #define INSTALL_PLUGINS_DIR     NS_LITERAL_CSTRING("plugins")
00117 #define INSTALL_COMPONENTS_DIR  NS_LITERAL_CSTRING("components")
00118 #define INSTALL_CHROME_DIR      NS_LITERAL_CSTRING("chrome")
00119 #endif
00120 
00121 class nsInstallFolder
00122 {
00123     public:
00124         
00125        nsInstallFolder();
00126        virtual ~nsInstallFolder();
00127 
00128        nsresult Init(nsInstallFolder& inFolder, const nsString& subString);
00129        nsresult Init(const nsAString& aFolderID, const nsString& aRelativePath);
00130        nsresult Init(nsIFile* rawIFile, const nsString& aRelativePath);
00131 
00132        void GetDirectoryPath(nsCString& aDirectoryPath);
00133        nsIFile* GetFileSpec();
00134        PRInt32 ToString(nsAutoString* outString);
00135        
00136     private:
00137         
00138         nsCOMPtr<nsIFile>  mFileSpec;
00139 
00140         void         SetDirectoryPath(const nsAString& aFolderID, const nsString& aRelativePath);
00141         void         AppendXPPath(const nsString& aRelativePath);
00142         PRInt32      MapNameToEnum(const nsAString&  name);
00143 };
00144 
00145 
00146 #endif