Back to index

lightning-sunbird  0.9+nobinonly
nsInstallResources.cpp
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  *   Samir Gehani <sgehani@netscape.com>
00027  *
00028  * Alternatively, the contents of this file may be used under the terms of
00029  * either of the GNU General Public License Version 2 or later (the "GPL"),
00030  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00031  * in which case the provisions of the GPL or the LGPL are applicable instead
00032  * of those above. If you wish to allow use of your version of this file only
00033  * under the terms of either the GPL or the LGPL, and not to allow others to
00034  * use your version of this file under the terms of the MPL, indicate your
00035  * decision by deleting the provisions above and replace them with the notice
00036  * and other provisions required by the GPL or the LGPL. If you do not delete
00037  * the provisions above, a recipient may use your version of this file under
00038  * the terms of any one of the MPL, the GPL or the LGPL.
00039  *
00040  * ***** END LICENSE BLOCK ***** */
00041 
00042 #include <string.h>
00043 #include "nscore.h"
00044 #include "nsInstallResources.h"
00045 
00046 static nsXPIResourceTableItem XPIResTable[] = 
00047 {
00048     /*---------------------------------------------------------------------*
00049      *   Install Actions 
00050      *---------------------------------------------------------------------*/
00051     { "InstallFile",        "Installing: %s" },
00052     { "InstallSharedFile",  "Installing Shared File: %s" },
00053     { "ReplaceFile",        "Replacing: %s" },
00054     { "ReplaceSharedFile",  "Replacing Shared File: %s" },
00055     { "SkipFile",           "Skipping: %s" },
00056     { "SkipSharedFile",     "Skipping Shared File: %s" },
00057     { "DeleteFile",         "Deleting file: %s" },
00058     { "DeleteComponent",    "Deleting component: %s" },
00059     { "Execute",            "Executing: %s" },
00060     { "ExecuteWithArgs",    "Executing: %s with argument: %s" },
00061     { "Patch",              "Patching: %s" },
00062     { "Uninstall",          "Uninstalling: %s" },
00063     { "RegSkin",            "Register Skin: %s" },
00064     { "RegLocale",          "Register Locale: %s" },
00065     { "RegContent",         "Register Content: %s" },
00066     { "RegPackage",         "Register Package: %s" },
00067 
00068 
00069     { "CopyFile",              "Copy File: %s to %s" },
00070     { "ExecuteFile",           "Execute File: %s" },
00071     { "ExecuteFileWithArgs",   "Execute File: %s with argument: %s" },
00072     { "MoveFile",              "Move File: %s to %s" },
00073     { "RenameFile",            "Rename File: %s to %s" },
00074     { "CreateFolder",          "Create Folder: %s" },
00075     { "RemoveFolder",          "Remove Folder: %s" },
00076     { "RenameFolder",          "Rename Folder: %s to %s" },
00077     { "WindowsShortcut",       "Windows Shortcut: %s" },
00078     { "MacAlias",              "Mac Alias: %s" },
00079     { "WindowsRegisterServer", "Windows Register Server: %s" },
00080     { "UnknownFileOpCommand",  "Unknown file operation command!" },
00081 
00082     // XXX FileOp*() action strings
00083     // XXX WinReg and WinProfile action strings
00084 
00085     /*---------------------------------------------------------------------*
00086      *    Miscellaneous 
00087      *---------------------------------------------------------------------*/
00088     { "ERROR", "ERROR" },
00089 
00090     { NS_XPI_EOT, "" }
00091 };
00092 
00093 char* 
00094 nsInstallResources::GetDefaultVal(const char* aResName)
00095 {
00096     char    *currResName = XPIResTable[0].resName;
00097     char    *currResVal = nsnull;
00098     PRInt32 idx, len = 0;
00099 
00100     for (idx = 0; 0 != strcmp(currResName, NS_XPI_EOT); idx++)
00101     {
00102         currResName = XPIResTable[idx].resName;
00103         len = strlen(currResName);
00104 
00105         if (0 == strncmp(currResName, aResName, len))
00106         {
00107             currResVal = XPIResTable[idx].defaultString;
00108             break;
00109         }
00110     }
00111 
00112     return currResVal;
00113 }
00114