Installer: Move path string constants to new InstallerDefs.h/cpp
This commit is contained in:
@@ -19,8 +19,7 @@
|
|||||||
#include <String.h>
|
#include <String.h>
|
||||||
#include <SymLink.h>
|
#include <SymLink.h>
|
||||||
|
|
||||||
#include "InstallerWindow.h"
|
#include "InstallerDefs.h"
|
||||||
// TODO: For PACKAGES_DIRECTORY and VAR_DIRECTORY, not so nice...
|
|
||||||
#include "SemaphoreLocker.h"
|
#include "SemaphoreLocker.h"
|
||||||
#include "ProgressReporter.h"
|
#include "ProgressReporter.h"
|
||||||
|
|
||||||
@@ -107,7 +106,7 @@ CopyEngine::ResetTargets(const char* source)
|
|||||||
// makes sense, since passing a volume is meant to folders that are
|
// makes sense, since passing a volume is meant to folders that are
|
||||||
// volume specific, like "trash".
|
// volume specific, like "trash".
|
||||||
BPath path(source);
|
BPath path(source);
|
||||||
if (path.Append("common/var/swap") == B_OK)
|
if (path.Append(kSwapFilePath) == B_OK)
|
||||||
fSwapFileEntry.SetTo(path.Path());
|
fSwapFileEntry.SetTo(path.Path());
|
||||||
else
|
else
|
||||||
fSwapFileEntry.Unset();
|
fSwapFileEntry.Unset();
|
||||||
@@ -508,16 +507,16 @@ CopyEngine::_ShouldCopyEntry(const BEntry& entry, const char* name,
|
|||||||
const struct stat& statInfo, int32 level) const
|
const struct stat& statInfo, int32 level) const
|
||||||
{
|
{
|
||||||
if (level == 1 && S_ISDIR(statInfo.st_mode)) {
|
if (level == 1 && S_ISDIR(statInfo.st_mode)) {
|
||||||
if (strcmp(VAR_DIRECTORY, name) == 0) {
|
if (strcmp(kVarDirectoryPath, name) == 0) {
|
||||||
// old location of /boot/var
|
// old location of /boot/var
|
||||||
printf("ignoring '%s'.\n", name);
|
printf("ignoring '%s'.\n", name);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (strcmp(PACKAGES_DIRECTORY, name) == 0) {
|
if (strcmp(kPackagesDirectoryPath, name) == 0) {
|
||||||
printf("ignoring '%s'.\n", name);
|
printf("ignoring '%s'.\n", name);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (strcmp(SOURCES_DIRECTORY, name) == 0) {
|
if (strcmp(kSourcesDirectoryPath, name) == 0) {
|
||||||
printf("ignoring '%s'.\n", name);
|
printf("ignoring '%s'.\n", name);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2013, Haiku, Inc.
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "InstallerDefs.h"
|
||||||
|
|
||||||
|
|
||||||
|
const char* const kPackagesDirectoryPath = "_packages_";
|
||||||
|
const char* const kSourcesDirectoryPath = "_sources_";
|
||||||
|
const char* const kVarDirectoryPath = "var";
|
||||||
|
const char* const kSwapFilePath = "common/var/swap";
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2013, Haiku, Inc.
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*/
|
||||||
|
#ifndef INSTALLER_DEFS_H
|
||||||
|
#define INSTALLER_DEFS_H
|
||||||
|
|
||||||
|
|
||||||
|
extern const char* const kPackagesDirectoryPath;
|
||||||
|
extern const char* const kSourcesDirectoryPath;
|
||||||
|
extern const char* const kVarDirectoryPath;
|
||||||
|
extern const char* const kSwapFilePath;
|
||||||
|
|
||||||
|
|
||||||
|
#endif // INSTALLER_DEFS_H
|
||||||
@@ -40,6 +40,7 @@
|
|||||||
#include "tracker_private.h"
|
#include "tracker_private.h"
|
||||||
|
|
||||||
#include "DialogPane.h"
|
#include "DialogPane.h"
|
||||||
|
#include "InstallerDefs.h"
|
||||||
#include "PackageViews.h"
|
#include "PackageViews.h"
|
||||||
#include "PartitionMenuItem.h"
|
#include "PartitionMenuItem.h"
|
||||||
#include "WorkerThread.h"
|
#include "WorkerThread.h"
|
||||||
@@ -838,7 +839,7 @@ InstallerWindow::_PublishPackages()
|
|||||||
} else
|
} else
|
||||||
return; // shouldn't happen
|
return; // shouldn't happen
|
||||||
|
|
||||||
directory.Append(PACKAGES_DIRECTORY);
|
directory.Append(kPackagesDirectoryPath);
|
||||||
BDirectory dir(directory.Path());
|
BDirectory dir(directory.Path());
|
||||||
if (dir.InitCheck() != B_OK)
|
if (dir.InitCheck() != B_OK)
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -39,10 +39,6 @@ const uint32 MSG_INSTALL_FINISHED = 'iIFN';
|
|||||||
const uint32 MSG_RESET = 'iRSI';
|
const uint32 MSG_RESET = 'iRSI';
|
||||||
const uint32 MSG_WRITE_BOOT_SECTOR = 'iWBS';
|
const uint32 MSG_WRITE_BOOT_SECTOR = 'iWBS';
|
||||||
|
|
||||||
const char PACKAGES_DIRECTORY[] = "_packages_";
|
|
||||||
const char SOURCES_DIRECTORY[] = "_sources_";
|
|
||||||
const char VAR_DIRECTORY[] = "var";
|
|
||||||
|
|
||||||
|
|
||||||
class InstallerWindow : public BWindow {
|
class InstallerWindow : public BWindow {
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ SubDirHdrs [ FDirName $(HAIKU_TOP) src kits tracker ] ;
|
|||||||
Application Installer :
|
Application Installer :
|
||||||
CopyEngine.cpp
|
CopyEngine.cpp
|
||||||
InstallerApp.cpp
|
InstallerApp.cpp
|
||||||
|
InstallerDefs.cpp
|
||||||
InstallerWindow.cpp
|
InstallerWindow.cpp
|
||||||
PackageViews.cpp
|
PackageViews.cpp
|
||||||
PartitionMenuItem.cpp
|
PartitionMenuItem.cpp
|
||||||
@@ -26,4 +27,3 @@ DoCatalogs Installer :
|
|||||||
ProgressReporter.cpp
|
ProgressReporter.cpp
|
||||||
WorkerThread.cpp
|
WorkerThread.cpp
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|||||||
@@ -28,6 +28,7 @@
|
|||||||
|
|
||||||
#include "AutoLocker.h"
|
#include "AutoLocker.h"
|
||||||
#include "CopyEngine.h"
|
#include "CopyEngine.h"
|
||||||
|
#include "InstallerDefs.h"
|
||||||
#include "InstallerWindow.h"
|
#include "InstallerWindow.h"
|
||||||
#include "PackageViews.h"
|
#include "PackageViews.h"
|
||||||
#include "PartitionMenuItem.h"
|
#include "PartitionMenuItem.h"
|
||||||
@@ -423,7 +424,7 @@ WorkerThread::_PerformInstall(BMenu* srcMenu, BMenu* targetMenu)
|
|||||||
|
|
||||||
// Collect selected packages also
|
// Collect selected packages also
|
||||||
if (fPackages) {
|
if (fPackages) {
|
||||||
BPath pkgRootDir(srcDirectory.Path(), PACKAGES_DIRECTORY);
|
BPath pkgRootDir(srcDirectory.Path(), kPackagesDirectoryPath);
|
||||||
int32 count = fPackages->CountItems();
|
int32 count = fPackages->CountItems();
|
||||||
for (int32 i = 0; i < count; i++) {
|
for (int32 i = 0; i < count; i++) {
|
||||||
Package *p = static_cast<Package*>(fPackages->ItemAt(i));
|
Package *p = static_cast<Package*>(fPackages->ItemAt(i));
|
||||||
@@ -450,7 +451,7 @@ WorkerThread::_PerformInstall(BMenu* srcMenu, BMenu* targetMenu)
|
|||||||
|
|
||||||
// copy selected packages
|
// copy selected packages
|
||||||
if (fPackages) {
|
if (fPackages) {
|
||||||
BPath pkgRootDir(srcDirectory.Path(), PACKAGES_DIRECTORY);
|
BPath pkgRootDir(srcDirectory.Path(), kPackagesDirectoryPath);
|
||||||
int32 count = fPackages->CountItems();
|
int32 count = fPackages->CountItems();
|
||||||
for (int32 i = 0; i < count; i++) {
|
for (int32 i = 0; i < count; i++) {
|
||||||
Package *p = static_cast<Package*>(fPackages->ItemAt(i));
|
Package *p = static_cast<Package*>(fPackages->ItemAt(i));
|
||||||
@@ -586,7 +587,7 @@ WorkerThread::_ProcessZipPackages(const char* sourcePath,
|
|||||||
// TODO: Put those in the optional packages list view
|
// TODO: Put those in the optional packages list view
|
||||||
// TODO: Implement mechanism to handle dependencies between these
|
// TODO: Implement mechanism to handle dependencies between these
|
||||||
// packages. (Selecting one will auto-select others.)
|
// packages. (Selecting one will auto-select others.)
|
||||||
BPath pkgRootDir(sourcePath, PACKAGES_DIRECTORY);
|
BPath pkgRootDir(sourcePath, kPackagesDirectoryPath);
|
||||||
BDirectory directory(pkgRootDir.Path());
|
BDirectory directory(pkgRootDir.Path());
|
||||||
BEntry entry;
|
BEntry entry;
|
||||||
while (directory.GetNextEntry(&entry) == B_OK) {
|
while (directory.GetNextEntry(&entry) == B_OK) {
|
||||||
|
|||||||
Reference in New Issue
Block a user