зеркало из https://github.com/mozilla/pjs.git
Fix for bug 11279: Change CCK directory structure to support different
plaltforms and languages (r=smeredith)
This commit is contained in:
Родитель
1ce02b59cf
Коммит
85c4786063
|
@ -35,16 +35,16 @@ onNext=
|
|||
Help=cck.txt
|
||||
|
||||
[Sub Pages]
|
||||
CheckList=show
|
||||
Linux_page=show
|
||||
CheckList=show
|
||||
Platform_page=show
|
||||
Info=show
|
||||
Branding_page1=show
|
||||
Customize_page3=show
|
||||
;Branding_page5=show
|
||||
Customize_page1=show
|
||||
Mail_page=show
|
||||
News_page=show
|
||||
Proxy=show
|
||||
Customize_page1=show
|
||||
Mail_page=show
|
||||
News_page=show
|
||||
Proxy=show
|
||||
Branding_page2=show
|
||||
;Branding_page4=show
|
||||
Build_page1=show
|
||||
|
|
|
@ -16,14 +16,6 @@ CString iniDstPath;
|
|||
CString scriptPath;
|
||||
CString nscpxpiPath;
|
||||
|
||||
CString linuxOption;
|
||||
CString linuxblobPath;
|
||||
CString linuxDir;
|
||||
CString nsinstPath;
|
||||
CString xpiDir;
|
||||
CString tarfile;
|
||||
CString quotes;
|
||||
|
||||
COMPONENT Components[100];
|
||||
int numComponents;
|
||||
|
||||
|
@ -111,54 +103,16 @@ int GenerateComponentList(CString parms, WIDGET *curWidget)
|
|||
configPath = rootPath + "Configs\\" + configName;
|
||||
workspacePath = configPath + "\\Workspace";
|
||||
nscpxpiPath;
|
||||
CString curVersion = GetGlobal("Version");
|
||||
CString curPlatform = GetGlobal("lPlatform");
|
||||
CString curLanguage = GetGlobal("Language");
|
||||
CString localePath = rootPath+"Version\\"+curVersion+"\\"+curPlatform+"\\"+curLanguage;
|
||||
|
||||
linuxOption = GetGlobal("lPlatform");
|
||||
if (linuxOption == "Linux")
|
||||
{
|
||||
linuxblobPath = GetGlobal("LinuxPath");
|
||||
linuxDir = "nscpxpiLinux";
|
||||
nsinstPath = "\\netscape-installer\\xpi";
|
||||
xpiDir = "\\xpi";
|
||||
CString tnscpxpilinuxPath = rootPath + linuxDir;
|
||||
CString nscpxpilinuxPath = tnscpxpilinuxPath;
|
||||
int pathlen = linuxblobPath.GetLength();
|
||||
int pos = linuxblobPath.ReverseFind('\\');
|
||||
pos += 1;
|
||||
CString linuxinstDirPath = linuxblobPath.Left(pos);
|
||||
tarfile = linuxblobPath.Right(pathlen-pos);
|
||||
|
||||
int direxist = GetFileAttributes(nscpxpilinuxPath);
|
||||
if ((direxist == -1) && (linuxblobPath != ""))
|
||||
// nscpxpiLinux directory does not exist
|
||||
{
|
||||
quotes = "\"";
|
||||
char currentdir[_MAX_PATH];
|
||||
_getcwd(currentdir, _MAX_PATH);
|
||||
_chdir(rootPath);
|
||||
_mkdir(linuxDir);
|
||||
_chdir(linuxinstDirPath);
|
||||
tnscpxpilinuxPath.Replace("\\","/");
|
||||
tnscpxpilinuxPath.Replace(":","");
|
||||
tnscpxpilinuxPath.Insert(0,"/cygdrive/");
|
||||
CString command = "tar -zxvf " + tarfile + " -C " + quotes + tnscpxpilinuxPath + quotes;
|
||||
ExecuteCommand((char *)(LPCTSTR) command, SW_HIDE, INFINITE);
|
||||
|
||||
nscpxpiPath = nscpxpilinuxPath + nsinstPath;
|
||||
CString tempxpiPath = nscpxpiPath;
|
||||
tempxpiPath.Replace(xpiDir,"");
|
||||
CopyFile(tempxpiPath+"\\Config.ini", nscpxpiPath+"\\Config.ini",
|
||||
FALSE);
|
||||
_chdir(currentdir);
|
||||
}
|
||||
nscpxpiPath = nscpxpilinuxPath + nsinstPath;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (SearchPath(workspacePath, "NSCPXPI", NULL, 0, NULL, NULL))
|
||||
nscpxpiPath = workspacePath + "\\NSCPXPI";
|
||||
else
|
||||
nscpxpiPath = rootPath + "NSCPXPI";
|
||||
}
|
||||
nscpxpiPath = localePath + "\\Nscpxpi";
|
||||
|
||||
iniSrcPath = nscpxpiPath + "\\config.ini";
|
||||
|
||||
BuildComponentList(Components, &numComponents, iniSrcPath, 1);
|
||||
|
|
|
@ -137,6 +137,38 @@ void ExecuteCommand(char *command, int showflag, DWORD wait)
|
|||
WaitForSingleObject(processInfo.hProcess, wait);
|
||||
}
|
||||
|
||||
extern "C" __declspec(dllexport)
|
||||
void CopyDirectory(CString source, CString dest, BOOL subdir)
|
||||
// Copy files in subdirectories if the subdir flag is set (equal to 1).
|
||||
{
|
||||
CFileFind finder;
|
||||
CString sFileToFind = source + "\\*.*";
|
||||
BOOL bWorking = finder.FindFile(sFileToFind);
|
||||
while (bWorking)
|
||||
{
|
||||
bWorking = finder.FindNextFile();
|
||||
CString newPath=dest + "\\";
|
||||
|
||||
if (finder.IsDots()) continue;
|
||||
if (finder.IsDirectory())
|
||||
{
|
||||
CString dirPath = finder.GetFilePath();
|
||||
newPath += finder.GetFileName();
|
||||
_mkdir(newPath);
|
||||
if (subdir == TRUE)
|
||||
CopyDirectory(dirPath, newPath, TRUE);
|
||||
if (!CopyFile(dirPath,newPath,0))
|
||||
DWORD e = GetLastError();
|
||||
continue;
|
||||
}
|
||||
|
||||
newPath += finder.GetFileName();
|
||||
CString source = finder.GetFilePath();
|
||||
if (!CopyFile(source,newPath,0))
|
||||
DWORD e = GetLastError();
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" __declspec(dllexport)
|
||||
void EraseDirectory(CString sPath)
|
||||
{
|
||||
|
@ -159,6 +191,125 @@ void EraseDirectory(CString sPath)
|
|||
}
|
||||
}
|
||||
|
||||
__declspec(dllexport)
|
||||
CString SearchDirectory(CString dirPath, BOOL subDir, CString serachStr)
|
||||
// This function searches all the files in the directory dirPath,
|
||||
// for the file whose name contains the search string serachStr,
|
||||
// searching recursively if subDir is TRUE
|
||||
{
|
||||
CFileFind finder;
|
||||
CString filePath;
|
||||
CString fileName;
|
||||
CString retval;
|
||||
CString sFileToFind = dirPath + "\\*.*";
|
||||
BOOL found = finder.FindFile(sFileToFind);
|
||||
while (found)
|
||||
{
|
||||
found = finder.FindNextFile();
|
||||
|
||||
if (finder.IsDots()) continue;
|
||||
|
||||
filePath = finder.GetFilePath();
|
||||
fileName = finder.GetFileName();
|
||||
if (fileName.Find(serachStr) != -1)
|
||||
return fileName;
|
||||
|
||||
if (finder.IsDirectory())
|
||||
{
|
||||
if (subDir == TRUE)
|
||||
retval = SearchDirectory(filePath, TRUE, serachStr);
|
||||
return retval;
|
||||
}
|
||||
}
|
||||
return fileName;
|
||||
}
|
||||
|
||||
extern "C" __declspec(dllexport)
|
||||
void CreateDirectories(CString instblobPath)
|
||||
// Create appropriate platform and language directories
|
||||
{
|
||||
CString quotes = "\"";
|
||||
CString rootPath = GetGlobal("Root");
|
||||
CString curVersion = GetGlobal("Version");
|
||||
int instblobPathlen = instblobPath.GetLength();
|
||||
int findfilePos = instblobPath.Find('.');
|
||||
int finddirPos = instblobPath.ReverseFind('\\');
|
||||
CString instDirname = instblobPath.Left(finddirPos);
|
||||
CString instFilename = instblobPath.Right(instblobPathlen - finddirPos -1);
|
||||
CString fileExtension = instblobPath.Right(instblobPathlen - findfilePos -1);
|
||||
SetGlobal("InstallerFilename",instFilename);
|
||||
|
||||
// Is the blob path a Linux blob installer
|
||||
if (fileExtension == "tar.gz")
|
||||
{
|
||||
char oldDir[MAX_SIZE];
|
||||
CString platformInfo = "Linux";
|
||||
CString platformPath = rootPath + "Version\\" + curVersion + "\\" + platformInfo;
|
||||
CString extractPath = platformPath + "\\" + "temp";
|
||||
CString tempPath = extractPath;
|
||||
|
||||
if (GetFileAttributes(platformPath) == -1)
|
||||
// platform directory does not exist
|
||||
_mkdir(platformPath);
|
||||
|
||||
// extract contents of Linux blob installer
|
||||
_mkdir(extractPath);
|
||||
GetCurrentDirectory(sizeof(oldDir), oldDir);
|
||||
SetCurrentDirectory((char *)(LPCTSTR) instDirname);
|
||||
tempPath.Replace("\\","/");
|
||||
tempPath.Replace(":","");
|
||||
tempPath.Insert(0,"/cygdrive/");
|
||||
CString command = "tar -zxvf " + instFilename + " -C " + quotes + tempPath + quotes;
|
||||
ExecuteCommand((char *)(LPCTSTR) command, SW_HIDE, INFINITE);
|
||||
CString searchStr = "defl";
|
||||
searchStr = SearchDirectory(extractPath, TRUE, searchStr);
|
||||
|
||||
if (searchStr != "")
|
||||
{
|
||||
CString languageInfo = searchStr.Mid(4,4);
|
||||
CString languagePath = rootPath + "Version\\" + curVersion + "\\" + platformInfo + "\\" + languageInfo;
|
||||
CString nscpxpiPath = languagePath + "\\Nscpxpi";
|
||||
|
||||
_mkdir(languagePath);
|
||||
_mkdir(nscpxpiPath);
|
||||
|
||||
// checking if nscpxpi directory is non-empty
|
||||
// to avoid the steps of populating installer files
|
||||
BOOL empty = TRUE;
|
||||
CFileFind fn;
|
||||
if (fn.FindFile(nscpxpiPath+"\\*.*") != 0)
|
||||
{
|
||||
while (TRUE)
|
||||
{
|
||||
int fileExist = fn.FindNextFile();
|
||||
if (!fn.IsDots())
|
||||
{
|
||||
empty = FALSE;
|
||||
break;
|
||||
}
|
||||
if (fileExist == 0) break;
|
||||
}
|
||||
}
|
||||
if (empty)
|
||||
{
|
||||
CString nsinstallerStr = "\\netscape-installer";
|
||||
_mkdir(nscpxpiPath+nsinstallerStr);
|
||||
CopyDirectory(extractPath+nsinstallerStr+"\\xpi",
|
||||
nscpxpiPath, TRUE);
|
||||
CopyDirectory(extractPath+nsinstallerStr,
|
||||
nscpxpiPath+nsinstallerStr, FALSE);
|
||||
CopyFile(nscpxpiPath+nsinstallerStr+"\\Config.ini",
|
||||
nscpxpiPath+"\\Config.ini", FALSE);
|
||||
CopyFile(rootPath+"script_linux.ib",
|
||||
languagePath+"\\script.ib", FALSE);
|
||||
}
|
||||
}
|
||||
EraseDirectory(extractPath);
|
||||
RemoveDirectory(extractPath);
|
||||
SetCurrentDirectory(oldDir);
|
||||
}
|
||||
}
|
||||
|
||||
__declspec(dllexport)
|
||||
CString GetModulePath()
|
||||
{
|
||||
|
|
|
@ -12,5 +12,8 @@ extern "C" __declspec(dllimport) WIDGET* findWidget(CString theName);
|
|||
extern "C" __declspec(dllimport) void CopyDir(CString from, CString to, LPCTSTR extension, int overwrite);
|
||||
extern "C" __declspec(dllexport) void ExecuteCommand(char *command, int showflag, DWORD wait);
|
||||
extern "C" __declspec(dllimport) int GetAttrib(CString theValue, char* attribArray[]);
|
||||
extern "C" __declspec(dllimport) void CopyDirectory(CString source, CString dest, BOOL subdir);
|
||||
extern "C" __declspec(dllimport) void EraseDirectory(CString sPath);
|
||||
__declspec(dllimport) CString SearchDirectory(CString dirPath, BOOL subDir, CString searchStr);
|
||||
extern "C" __declspec(dllimport) void CreateDirectories(CString instblobPath);
|
||||
__declspec(dllimport) CString GetModulePath();
|
||||
|
|
Загрузка…
Ссылка в новой задаче