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