diff --git a/src/apps/installer/CopyEngine.cpp b/src/apps/installer/CopyEngine.cpp index a9fb1de985..3b58eb9132 100644 --- a/src/apps/installer/CopyEngine.cpp +++ b/src/apps/installer/CopyEngine.cpp @@ -19,8 +19,7 @@ #include #include -#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; } diff --git a/src/apps/installer/InstallerDefs.cpp b/src/apps/installer/InstallerDefs.cpp new file mode 100644 index 0000000000..ae4a55faf3 --- /dev/null +++ b/src/apps/installer/InstallerDefs.cpp @@ -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"; diff --git a/src/apps/installer/InstallerDefs.h b/src/apps/installer/InstallerDefs.h new file mode 100644 index 0000000000..3a16dfaf57 --- /dev/null +++ b/src/apps/installer/InstallerDefs.h @@ -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 diff --git a/src/apps/installer/InstallerWindow.cpp b/src/apps/installer/InstallerWindow.cpp index 251f4f57e3..5a681d5360 100644 --- a/src/apps/installer/InstallerWindow.cpp +++ b/src/apps/installer/InstallerWindow.cpp @@ -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; diff --git a/src/apps/installer/InstallerWindow.h b/src/apps/installer/InstallerWindow.h index 4ef3138248..14c297786d 100644 --- a/src/apps/installer/InstallerWindow.h +++ b/src/apps/installer/InstallerWindow.h @@ -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: diff --git a/src/apps/installer/Jamfile b/src/apps/installer/Jamfile index ff7553f92f..884a93e434 100644 --- a/src/apps/installer/Jamfile +++ b/src/apps/installer/Jamfile @@ -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 ; - diff --git a/src/apps/installer/WorkerThread.cpp b/src/apps/installer/WorkerThread.cpp index fbb4727430..064375a24d 100644 --- a/src/apps/installer/WorkerThread.cpp +++ b/src/apps/installer/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(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(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) {