Skip to content

Commit

Permalink
Bug 747597 - Part 2: Remove --install-app from XULRunner. r+sr=bsmedberg
Browse files Browse the repository at this point in the history
  • Loading branch information
ajvincent committed Apr 22, 2012
1 parent 01b0e1b commit 4403082
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 474 deletions.
99 changes: 2 additions & 97 deletions xulrunner/app/nsXULRunnerApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

#include "nsAppRunner.h"
#include "nsIFile.h"
#include "nsIXULAppInstall.h"
#include "nsCOMPtr.h"
#include "nsMemory.h"
#include "nsCRTGlue.h"
Expand Down Expand Up @@ -138,8 +137,6 @@ static void Usage(const char *argv0)
" -h, --help show this message\n"
" -v, --version show version\n"
" --gre-version print the GRE version string on stdout\n"
" --install-app <application> [<destination> [<directoryname>]]\n"
" Install a XUL application.\n"
"\n"
"APP-FILE\n"
" Application initialization file.\n"
Expand All @@ -162,73 +159,6 @@ static const nsDynamicFunctionLoad kXULFuncs[] = {
{ nullptr, nullptr }
};

static nsresult
GetXULRunnerDir(const char *argv0, nsIFile* *aResult)
{
nsresult rv;

nsCOMPtr<nsIFile> appFile;
rv = BinaryPath::GetFile(argv0, getter_AddRefs(appFile));
if (NS_FAILED(rv)) {
Output(true, "Could not find XULRunner application path.\n");
return rv;
}

rv = appFile->GetParent(aResult);
if (NS_FAILED(rv)) {
Output(true, "Could not find XULRunner installation dir.\n");
}
return rv;
}

static int
InstallXULApp(nsIFile* aXULRunnerDir,
const char *aAppLocation,
const char *aInstallTo,
const char *aLeafName)
{
nsCOMPtr<nsIFile> appLocation;
nsCOMPtr<nsIFile> installTo;
nsString leafName;

nsresult rv = XRE_GetFileFromPath(aAppLocation, getter_AddRefs(appLocation));
if (NS_FAILED(rv))
return 2;

if (aInstallTo) {
rv = XRE_GetFileFromPath(aInstallTo, getter_AddRefs(installTo));
if (NS_FAILED(rv))
return 2;
}

if (aLeafName)
NS_CStringToUTF16(nsDependentCString(aLeafName),
NS_CSTRING_ENCODING_NATIVE_FILESYSTEM, leafName);

rv = NS_InitXPCOM2(nullptr, aXULRunnerDir, nullptr);
if (NS_FAILED(rv))
return 3;

{
// Scope our COMPtr to avoid holding XPCOM refs beyond xpcom shutdown
nsCOMPtr<nsIXULAppInstall> install
(do_GetService("@mozilla.org/xulrunner/app-install-service;1"));
if (!install) {
rv = NS_ERROR_FAILURE;
}
else {
rv = install->InstallApplication(appLocation, installTo, leafName);
}
}

NS_ShutdownXPCOM(nullptr);

if (NS_FAILED(rv))
return 3;

return 0;
}

class AutoAppData
{
public:
Expand Down Expand Up @@ -311,33 +241,8 @@ int main(int argc, char* argv[])
}

if (IsArg(argv[1], "install-app")) {
if (argc < 3 || argc > 5) {
Usage(argv[0]);
return 1;
}

char *appLocation = argv[2];

char *installTo = nullptr;
if (argc > 3) {
installTo = argv[3];
if (!*installTo) // left blank?
installTo = nullptr;
}

char *leafName = nullptr;
if (argc > 4) {
leafName = argv[4];
if (!*leafName)
leafName = nullptr;
}

nsCOMPtr<nsIFile> regDir;
rv = GetXULRunnerDir(argv[0], getter_AddRefs(regDir));
if (NS_FAILED(rv))
return 2;

return InstallXULApp(regDir, appLocation, installTo, leafName);
Output(true, "--install-app support has been removed. Use 'python install-app.py' instead.\n");
return 1;
}
}

Expand Down
1 change: 0 additions & 1 deletion xulrunner/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ CONFIGURE_SUBST_FILES += ['installer/Makefile']

PARALLEL_DIRS += [
'app',
'setup',
'stub',
'examples',
]
Expand Down
21 changes: 0 additions & 21 deletions xulrunner/setup/moz.build

This file was deleted.

35 changes: 0 additions & 35 deletions xulrunner/setup/nsIXULAppInstall.idl

This file was deleted.

Loading

0 comments on commit 4403082

Please sign in to comment.