mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-09 17:31:47 +09:00
Mypal portable mode
This commit is contained in:
parent
32c50fd018
commit
633ef1c426
24 changed files with 299 additions and 25 deletions
|
|
@ -205,6 +205,7 @@ char **gRestartArgv;
|
|||
bool gIsGtest = false;
|
||||
|
||||
nsString gAbsoluteArgv0Path;
|
||||
uint32_t portable;
|
||||
|
||||
#if defined(MOZ_WIDGET_GTK)
|
||||
#include <glib.h>
|
||||
|
|
@ -1984,6 +1985,14 @@ SelectProfile(nsIProfileLock* *aResult, nsIToolkitProfileService* aProfileSvc, n
|
|||
return NS_LockProfilePath(lf, localDir, nullptr, aResult);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIFile> exeFile;
|
||||
nsIFile* rootDir=nullptr;
|
||||
if (portable>0){
|
||||
XRE_GetBinaryPath(gArgv[0], getter_AddRefs(exeFile));
|
||||
exeFile->GetParent(&rootDir);
|
||||
rootDir->AppendNative(NS_LITERAL_CSTRING("Profile"));
|
||||
}
|
||||
|
||||
ar = CheckArg("profile", true, &arg);
|
||||
if (ar == ARG_BAD) {
|
||||
PR_fprintf(PR_STDERR, "Error: argument --profile requires a path\n");
|
||||
|
|
@ -2040,7 +2049,15 @@ SelectProfile(nsIProfileLock* *aResult, nsIToolkitProfileService* aProfileSvc, n
|
|||
// main profile directory.
|
||||
rv = aProfileSvc->CreateProfile(lf, nsDependentCSubstring(arg, delim),
|
||||
getter_AddRefs(profile));
|
||||
} else {
|
||||
}
|
||||
else if(portable>0) {
|
||||
nsCOMPtr<nsIFile> lf;
|
||||
rootDir->GetParent(getter_AddRefs(lf));
|
||||
lf->AppendNative(nsDependentCString(arg));
|
||||
rv = aProfileSvc->CreateProfile(lf, nsDependentCString(arg),
|
||||
getter_AddRefs(profile));
|
||||
}
|
||||
else {
|
||||
rv = aProfileSvc->CreateProfile(nullptr, nsDependentCString(arg),
|
||||
getter_AddRefs(profile));
|
||||
}
|
||||
|
|
@ -2168,7 +2185,7 @@ SelectProfile(nsIProfileLock* *aResult, nsIToolkitProfileService* aProfileSvc, n
|
|||
|
||||
// create a default profile
|
||||
nsCOMPtr<nsIToolkitProfile> profile;
|
||||
nsresult rv = aProfileSvc->CreateProfile(nullptr, // choose a default dir for us
|
||||
nsresult rv = aProfileSvc->CreateProfile(rootDir, // choose a default dir for us
|
||||
NS_LITERAL_CSTRING("default"),
|
||||
getter_AddRefs(profile));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
|
|
@ -3061,6 +3078,12 @@ XREMain::XRE_mainInit(bool* aExitFlag)
|
|||
} else if (ar == ARG_FOUND) {
|
||||
SaveToEnv("MOZ_NO_REMOTE=1");
|
||||
}
|
||||
//MYPAL CODE
|
||||
//lstrcmpW(L"Teest",L"Teest");
|
||||
|
||||
mDirProvider.Portable(&portable);
|
||||
|
||||
if (portable==1) SaveToEnv("MOZ_NO_REMOTE=1");
|
||||
|
||||
ar = CheckArg("new-instance", true);
|
||||
if (ar == ARG_BAD) {
|
||||
|
|
@ -3435,7 +3458,7 @@ XREMain::XRE_mainStartup(bool* aExitFlag)
|
|||
}
|
||||
#endif
|
||||
|
||||
rv = NS_NewToolkitProfileService(getter_AddRefs(mProfileSvc));
|
||||
rv = NS_NewToolkitProfileService(getter_AddRefs(mProfileSvc),portable);
|
||||
if (rv == NS_ERROR_FILE_ACCESS_DENIED) {
|
||||
PR_fprintf(PR_STDERR, "Error: Access was denied while trying to open files in " \
|
||||
"your profile directory.\n");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue