mirror of
https://review.haiku-os.org/haiku
synced 2025-01-31 02:35:03 +01:00
44f919da9a
Summer of Code project. Thanks for your work Łukasz and I hope we can see more work from you. Still to do: - Create an icon. - Add pkg files to the MIME database with PackageInstaller as the default handler. The rdef here has the MIME type name for the pkg format should anyone else choose to add it :) - Support for running scripts included with packages. - Testing various different packages. - Fixing problems in the Haiku GUI layout system which affect the code used for various parts of the installer GUI (please bear with the commented out code for now.) - Adding this to the image. Tomorrow I will add Łukasz's InstalledPackages utility which can be used to view installed packages and uninstall them. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22525 a95241bf-73f2-0310-859d-f6bbb57e9c96
76 lines
1.7 KiB
C++
76 lines
1.7 KiB
C++
/*
|
|
* Copyright (c) 2007, Haiku, Inc.
|
|
* Distributed under the terms of the MIT license.
|
|
*
|
|
* Author:
|
|
* Łukasz 'Sil2100' Zemczak <sil2100@vexillium.org>
|
|
*/
|
|
#ifndef INSTALLEDPACKAGEINFO_H
|
|
#define INSTALLEDPACKAGEINFO_H
|
|
|
|
#include <File.h>
|
|
#include <String.h>
|
|
#include <List.h>
|
|
#include <Path.h>
|
|
|
|
|
|
#define P_BUSY_TRIES 10
|
|
|
|
enum {
|
|
P_PACKAGE_INFO = 'ppki'
|
|
};
|
|
|
|
extern const char * kPackagesDir;
|
|
|
|
|
|
// Useful function for fetching the package name and version without parsing all
|
|
// other data
|
|
const char * info_get_package_name(const char *filename);
|
|
const char * info_get_package_version(const char *filename);
|
|
|
|
|
|
class InstalledPackageInfo {
|
|
public:
|
|
InstalledPackageInfo();
|
|
InstalledPackageInfo(const char *packageName, const char *version = NULL,
|
|
bool create = false);
|
|
~InstalledPackageInfo();
|
|
|
|
status_t InitCheck();
|
|
status_t SetTo(const char *packageName, const char *version = NULL,
|
|
bool create = false);
|
|
|
|
void SetName(const char *name) { fName = name; }
|
|
const char *GetName() { return fName.String(); }
|
|
void SetDescription(const char *description) { fDescription = description; }
|
|
const char *GetDescription() { return fDescription.String(); }
|
|
//void SetVersion(const char *version) { fVersion = version; }
|
|
const char *GetVersion() { return fVersion.String(); }
|
|
void SetSpaceNeeded(uint64 size) { fSpaceNeeded = size; }
|
|
uint64 GetSpaceNeeded() { return fSpaceNeeded; }
|
|
|
|
status_t AddItem(const char *itemName);
|
|
|
|
status_t Uninstall();
|
|
status_t Save();
|
|
|
|
private:
|
|
void _ClearItemList();
|
|
|
|
status_t fStatus;
|
|
bool fIsUpToDate;
|
|
bool fCreate;
|
|
|
|
BString fName;
|
|
BString fDescription;
|
|
BString fVersion;
|
|
uint64 fSpaceNeeded;
|
|
BList fInstalledItems;
|
|
|
|
BPath fPathToInfo;
|
|
};
|
|
|
|
|
|
#endif
|
|
|