hpkg format: Generalize user/global settings file attributes
* For all identifiers: Rename global settings file to global writable file. We want to use the respective attribute also for other writable files, not only settings files. * User settings file/global writable file info/attribute: Add isDirectory property/child attribute. This allows declaring global/ user settings directories associated with the package.
This commit is contained in:
@@ -1 +0,0 @@
|
|||||||
#include <../os/package/GlobalSettingsFileInfo.h>
|
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
#include <../os/package/GlobalWritableFileInfo.h>
|
||||||
@@ -1 +0,0 @@
|
|||||||
#include <../os/package/SettingsFileUpdateType.h>
|
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
#include <../os/package/WritableFileUpdateType.h>
|
||||||
@@ -1,49 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2013, Haiku, Inc.
|
|
||||||
* Distributed under the terms of the MIT License.
|
|
||||||
*/
|
|
||||||
#ifndef _PACKAGE__GLOBAL_SETTINGS_FILE_INFO_H_
|
|
||||||
#define _PACKAGE__GLOBAL_SETTINGS_FILE_INFO_H_
|
|
||||||
|
|
||||||
|
|
||||||
#include <package/SettingsFileUpdateType.h>
|
|
||||||
#include <String.h>
|
|
||||||
|
|
||||||
|
|
||||||
namespace BPackageKit {
|
|
||||||
|
|
||||||
|
|
||||||
namespace BHPKG {
|
|
||||||
struct BGlobalSettingsFileInfoData;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
class BGlobalSettingsFileInfo {
|
|
||||||
public:
|
|
||||||
BGlobalSettingsFileInfo();
|
|
||||||
BGlobalSettingsFileInfo(
|
|
||||||
const BHPKG::BGlobalSettingsFileInfoData&
|
|
||||||
infoData);
|
|
||||||
BGlobalSettingsFileInfo(const BString& path,
|
|
||||||
BSettingsFileUpdateType updateType);
|
|
||||||
~BGlobalSettingsFileInfo();
|
|
||||||
|
|
||||||
status_t InitCheck() const;
|
|
||||||
|
|
||||||
const BString& Path() const;
|
|
||||||
bool IsIncluded() const;
|
|
||||||
BSettingsFileUpdateType UpdateType() const;
|
|
||||||
|
|
||||||
void SetTo(const BString& path,
|
|
||||||
BSettingsFileUpdateType updateType);
|
|
||||||
|
|
||||||
private:
|
|
||||||
BString fPath;
|
|
||||||
BSettingsFileUpdateType fUpdateType;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
} // namespace BPackageKit
|
|
||||||
|
|
||||||
|
|
||||||
#endif // _PACKAGE__GLOBAL_SETTINGS_FILE_INFO_H_
|
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2013, Haiku, Inc.
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*/
|
||||||
|
#ifndef _PACKAGE__GLOBAL_WRITABLE_FILE_INFO_H_
|
||||||
|
#define _PACKAGE__GLOBAL_WRITABLE_FILE_INFO_H_
|
||||||
|
|
||||||
|
|
||||||
|
#include <package/WritableFileUpdateType.h>
|
||||||
|
#include <String.h>
|
||||||
|
|
||||||
|
|
||||||
|
namespace BPackageKit {
|
||||||
|
|
||||||
|
|
||||||
|
namespace BHPKG {
|
||||||
|
struct BGlobalWritableFileInfoData;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class BGlobalWritableFileInfo {
|
||||||
|
public:
|
||||||
|
BGlobalWritableFileInfo();
|
||||||
|
BGlobalWritableFileInfo(
|
||||||
|
const BHPKG::BGlobalWritableFileInfoData&
|
||||||
|
infoData);
|
||||||
|
BGlobalWritableFileInfo(const BString& path,
|
||||||
|
BWritableFileUpdateType updateType,
|
||||||
|
bool isDirectory);
|
||||||
|
~BGlobalWritableFileInfo();
|
||||||
|
|
||||||
|
status_t InitCheck() const;
|
||||||
|
|
||||||
|
const BString& Path() const;
|
||||||
|
bool IsIncluded() const;
|
||||||
|
BWritableFileUpdateType UpdateType() const;
|
||||||
|
bool IsDirectory() const;
|
||||||
|
|
||||||
|
void SetTo(const BString& path,
|
||||||
|
BWritableFileUpdateType updateType,
|
||||||
|
bool isDirectory);
|
||||||
|
|
||||||
|
private:
|
||||||
|
BString fPath;
|
||||||
|
BWritableFileUpdateType fUpdateType;
|
||||||
|
bool fIsDirectory;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace BPackageKit
|
||||||
|
|
||||||
|
|
||||||
|
#endif // _PACKAGE__GLOBAL_WRITABLE_FILE_INFO_H_
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
#include <String.h>
|
#include <String.h>
|
||||||
#include <StringList.h>
|
#include <StringList.h>
|
||||||
|
|
||||||
#include <package/GlobalSettingsFileInfo.h>
|
#include <package/GlobalWritableFileInfo.h>
|
||||||
#include <package/PackageArchitecture.h>
|
#include <package/PackageArchitecture.h>
|
||||||
#include <package/PackageFlags.h>
|
#include <package/PackageFlags.h>
|
||||||
#include <package/PackageInfoAttributes.h>
|
#include <package/PackageInfoAttributes.h>
|
||||||
@@ -82,8 +82,8 @@ public:
|
|||||||
const BStringList& URLList() const;
|
const BStringList& URLList() const;
|
||||||
const BStringList& SourceURLList() const;
|
const BStringList& SourceURLList() const;
|
||||||
|
|
||||||
const BObjectList<BGlobalSettingsFileInfo>&
|
const BObjectList<BGlobalWritableFileInfo>&
|
||||||
GlobalSettingsFileInfos() const;
|
GlobalWritableFileInfos() const;
|
||||||
const BObjectList<BUserSettingsFileInfo>&
|
const BObjectList<BUserSettingsFileInfo>&
|
||||||
UserSettingsFileInfos() const;
|
UserSettingsFileInfos() const;
|
||||||
|
|
||||||
@@ -133,9 +133,9 @@ public:
|
|||||||
void ClearSourceURLList();
|
void ClearSourceURLList();
|
||||||
status_t AddSourceURL(const BString& url);
|
status_t AddSourceURL(const BString& url);
|
||||||
|
|
||||||
void ClearGlobalSettingsFileInfos();
|
void ClearGlobalWritableFileInfos();
|
||||||
status_t AddGlobalSettingsFileInfo(
|
status_t AddGlobalWritableFileInfo(
|
||||||
const BGlobalSettingsFileInfo& info);
|
const BGlobalWritableFileInfo& info);
|
||||||
|
|
||||||
void ClearUserSettingsFileInfos();
|
void ClearUserSettingsFileInfos();
|
||||||
status_t AddUserSettingsFileInfo(
|
status_t AddUserSettingsFileInfo(
|
||||||
@@ -193,7 +193,7 @@ public:
|
|||||||
public:
|
public:
|
||||||
static const char* const kElementNames[];
|
static const char* const kElementNames[];
|
||||||
static const char* const kArchitectureNames[];
|
static const char* const kArchitectureNames[];
|
||||||
static const char* const kSettingsFileUpdateTypes[];
|
static const char* const kWritableFileUpdateTypes[];
|
||||||
|
|
||||||
private:
|
private:
|
||||||
class Parser;
|
class Parser;
|
||||||
@@ -206,8 +206,8 @@ private:
|
|||||||
typedef BObjectList<BPackageResolvableExpression>
|
typedef BObjectList<BPackageResolvableExpression>
|
||||||
ResolvableExpressionList;
|
ResolvableExpressionList;
|
||||||
|
|
||||||
typedef BObjectList<BGlobalSettingsFileInfo>
|
typedef BObjectList<BGlobalWritableFileInfo>
|
||||||
GlobalSettingsFileInfoList;
|
GlobalWritableFileInfoList;
|
||||||
typedef BObjectList<BUserSettingsFileInfo>
|
typedef BObjectList<BUserSettingsFileInfo>
|
||||||
UserSettingsFileInfoList;
|
UserSettingsFileInfoList;
|
||||||
|
|
||||||
@@ -227,9 +227,9 @@ private:
|
|||||||
const char* field,
|
const char* field,
|
||||||
const ResolvableExpressionList&
|
const ResolvableExpressionList&
|
||||||
expressions);
|
expressions);
|
||||||
static status_t _AddGlobalSettingsFileInfos(BMessage* archive,
|
static status_t _AddGlobalWritableFileInfos(BMessage* archive,
|
||||||
const char* field,
|
const char* field,
|
||||||
const GlobalSettingsFileInfoList&
|
const GlobalWritableFileInfoList&
|
||||||
infos);
|
infos);
|
||||||
static status_t _AddUserSettingsFileInfos(BMessage* archive,
|
static status_t _AddUserSettingsFileInfos(BMessage* archive,
|
||||||
const char* field,
|
const char* field,
|
||||||
@@ -249,9 +249,9 @@ private:
|
|||||||
static status_t _ExtractResolvableExpressions(BMessage* archive,
|
static status_t _ExtractResolvableExpressions(BMessage* archive,
|
||||||
const char* field,
|
const char* field,
|
||||||
ResolvableExpressionList& _expressions);
|
ResolvableExpressionList& _expressions);
|
||||||
static status_t _ExtractGlobalSettingsFileInfos(
|
static status_t _ExtractGlobalWritableFileInfos(
|
||||||
BMessage* archive, const char* field,
|
BMessage* archive, const char* field,
|
||||||
GlobalSettingsFileInfoList& _infos);
|
GlobalWritableFileInfoList& _infos);
|
||||||
static status_t _ExtractUserSettingsFileInfos(
|
static status_t _ExtractUserSettingsFileInfos(
|
||||||
BMessage* archive, const char* field,
|
BMessage* archive, const char* field,
|
||||||
UserSettingsFileInfoList& _infos);
|
UserSettingsFileInfoList& _infos);
|
||||||
@@ -277,7 +277,7 @@ private:
|
|||||||
BStringList fURLList;
|
BStringList fURLList;
|
||||||
BStringList fSourceURLList;
|
BStringList fSourceURLList;
|
||||||
|
|
||||||
BObjectList<BGlobalSettingsFileInfo> fGlobalSettingsFileInfos;
|
BObjectList<BGlobalWritableFileInfo> fGlobalWritableFileInfos;
|
||||||
BObjectList<BUserSettingsFileInfo> fUserSettingsFileInfos;
|
BObjectList<BUserSettingsFileInfo> fUserSettingsFileInfos;
|
||||||
|
|
||||||
UserList fUsers;
|
UserList fUsers;
|
||||||
|
|||||||
@@ -41,8 +41,8 @@ enum BPackageInfoAttributeID {
|
|||||||
B_PACKAGE_INFO_INSTALL_PATH, // package install path; only for package
|
B_PACKAGE_INFO_INSTALL_PATH, // package install path; only for package
|
||||||
// building
|
// building
|
||||||
B_PACKAGE_INFO_BASE_PACKAGE, // name of the base package for this package
|
B_PACKAGE_INFO_BASE_PACKAGE, // name of the base package for this package
|
||||||
B_PACKAGE_INFO_GLOBAL_SETTINGS_FILES,
|
B_PACKAGE_INFO_GLOBAL_WRITABLE_FILES,
|
||||||
// list of global settings file infos
|
// list of global writable file infos
|
||||||
B_PACKAGE_INFO_USER_SETTINGS_FILES,
|
B_PACKAGE_INFO_USER_SETTINGS_FILES,
|
||||||
// list of user settings file infos
|
// list of user settings file infos
|
||||||
B_PACKAGE_INFO_USERS,
|
B_PACKAGE_INFO_USERS,
|
||||||
|
|||||||
@@ -1,35 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2013, Haiku, Inc.
|
|
||||||
* Distributed under the terms of the MIT License.
|
|
||||||
*/
|
|
||||||
#ifndef _PACKAGE__SETTINGS_FILE_UPDATE_TYPE_H_
|
|
||||||
#define _PACKAGE__SETTINGS_FILE_UPDATE_TYPE_H_
|
|
||||||
|
|
||||||
|
|
||||||
#include <String.h>
|
|
||||||
|
|
||||||
|
|
||||||
namespace BPackageKit {
|
|
||||||
|
|
||||||
|
|
||||||
// global settings file update types -- specifies behavior in case the previous
|
|
||||||
// version of a settings file provided by a package has been changed by the
|
|
||||||
// user.
|
|
||||||
enum BSettingsFileUpdateType {
|
|
||||||
B_SETTINGS_FILE_UPDATE_TYPE_KEEP_OLD = 0,
|
|
||||||
// the old settings file can be kept
|
|
||||||
B_SETTINGS_FILE_UPDATE_TYPE_MANUAL = 1,
|
|
||||||
// the old settings file needs to be updated manually
|
|
||||||
B_SETTINGS_FILE_UPDATE_TYPE_AUTO_MERGE = 2,
|
|
||||||
// try a three-way merge
|
|
||||||
|
|
||||||
B_SETTINGS_FILE_UPDATE_TYPE_ENUM_COUNT,
|
|
||||||
|
|
||||||
B_SETTINGS_FILE_UPDATE_TYPE_DEFAULT = B_SETTINGS_FILE_UPDATE_TYPE_KEEP_OLD
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
} // namespace BPackageKit
|
|
||||||
|
|
||||||
|
|
||||||
#endif // _PACKAGE__SETTINGS_FILE_UPDATE_TYPE_H_
|
|
||||||
@@ -25,19 +25,25 @@ public:
|
|||||||
infoData);
|
infoData);
|
||||||
BUserSettingsFileInfo(const BString& path,
|
BUserSettingsFileInfo(const BString& path,
|
||||||
const BString& templatePath = BString());
|
const BString& templatePath = BString());
|
||||||
|
BUserSettingsFileInfo(const BString& path,
|
||||||
|
bool isDirectory);
|
||||||
~BUserSettingsFileInfo();
|
~BUserSettingsFileInfo();
|
||||||
|
|
||||||
status_t InitCheck() const;
|
status_t InitCheck() const;
|
||||||
|
|
||||||
const BString& Path() const;
|
const BString& Path() const;
|
||||||
const BString& TemplatePath() const;
|
const BString& TemplatePath() const;
|
||||||
|
bool IsDirectory() const;
|
||||||
|
|
||||||
void SetTo(const BString& path,
|
void SetTo(const BString& path,
|
||||||
const BString& templatePath = BString());
|
const BString& templatePath = BString());
|
||||||
|
void SetTo(const BString& path,
|
||||||
|
bool isDirectory);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
BString fPath;
|
BString fPath;
|
||||||
BString fTemplatePath;
|
BString fTemplatePath;
|
||||||
|
bool fIsDirectory;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,35 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2013, Haiku, Inc.
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*/
|
||||||
|
#ifndef _PACKAGE__WRITABLE_FILE_UPDATE_TYPE_H_
|
||||||
|
#define _PACKAGE__WRITABLE_FILE_UPDATE_TYPE_H_
|
||||||
|
|
||||||
|
|
||||||
|
#include <String.h>
|
||||||
|
|
||||||
|
|
||||||
|
namespace BPackageKit {
|
||||||
|
|
||||||
|
|
||||||
|
// global writable file update types -- specifies behavior in case the previous
|
||||||
|
// version of a writable file provided by a package has been changed by the
|
||||||
|
// user.
|
||||||
|
enum BWritableFileUpdateType {
|
||||||
|
B_WRITABLE_FILE_UPDATE_TYPE_KEEP_OLD = 0,
|
||||||
|
// the old writable file can be kept
|
||||||
|
B_WRITABLE_FILE_UPDATE_TYPE_MANUAL = 1,
|
||||||
|
// the old writable file needs to be updated manually
|
||||||
|
B_WRITABLE_FILE_UPDATE_TYPE_AUTO_MERGE = 2,
|
||||||
|
// try a three-way merge
|
||||||
|
|
||||||
|
B_WRITABLE_FILE_UPDATE_TYPE_ENUM_COUNT,
|
||||||
|
|
||||||
|
B_WRITABLE_FILE_UPDATE_TYPE_DEFAULT = B_WRITABLE_FILE_UPDATE_TYPE_KEEP_OLD
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace BPackageKit
|
||||||
|
|
||||||
|
|
||||||
|
#endif // _PACKAGE__WRITABLE_FILE_UPDATE_TYPE_H_
|
||||||
@@ -62,12 +62,12 @@ B_DEFINE_HPKG_ATTRIBUTE(40, STRING, "package:install-path",
|
|||||||
PACKAGE_INSTALL_PATH)
|
PACKAGE_INSTALL_PATH)
|
||||||
B_DEFINE_HPKG_ATTRIBUTE(41, STRING, "package:base-package",
|
B_DEFINE_HPKG_ATTRIBUTE(41, STRING, "package:base-package",
|
||||||
PACKAGE_BASE_PACKAGE)
|
PACKAGE_BASE_PACKAGE)
|
||||||
B_DEFINE_HPKG_ATTRIBUTE(42, STRING, "package:global-settings-file",
|
B_DEFINE_HPKG_ATTRIBUTE(42, STRING, "package:global-writable-file",
|
||||||
PACKAGE_GLOBAL_SETTINGS_FILE)
|
PACKAGE_GLOBAL_WRITABLE_FILE)
|
||||||
B_DEFINE_HPKG_ATTRIBUTE(43, STRING, "package:user-settings-file",
|
B_DEFINE_HPKG_ATTRIBUTE(43, STRING, "package:user-settings-file",
|
||||||
PACKAGE_USER_SETTINGS_FILE)
|
PACKAGE_USER_SETTINGS_FILE)
|
||||||
B_DEFINE_HPKG_ATTRIBUTE(44, UINT, "package:settings-file-update-type",
|
B_DEFINE_HPKG_ATTRIBUTE(44, UINT, "package:writable-file-update-type",
|
||||||
PACKAGE_SETTINGS_FILE_UPDATE_TYPE)
|
PACKAGE_WRITABLE_FILE_UPDATE_TYPE)
|
||||||
B_DEFINE_HPKG_ATTRIBUTE(45, STRING, "package:settings-file-template",
|
B_DEFINE_HPKG_ATTRIBUTE(45, STRING, "package:settings-file-template",
|
||||||
PACKAGE_SETTINGS_FILE_TEMPLATE)
|
PACKAGE_SETTINGS_FILE_TEMPLATE)
|
||||||
B_DEFINE_HPKG_ATTRIBUTE(46, STRING, "package:user", PACKAGE_USER)
|
B_DEFINE_HPKG_ATTRIBUTE(46, STRING, "package:user", PACKAGE_USER)
|
||||||
@@ -79,3 +79,5 @@ B_DEFINE_HPKG_ATTRIBUTE(50, STRING, "package:user.group", PACKAGE_USER_GROUP)
|
|||||||
B_DEFINE_HPKG_ATTRIBUTE(51, STRING, "package:group", PACKAGE_GROUP)
|
B_DEFINE_HPKG_ATTRIBUTE(51, STRING, "package:group", PACKAGE_GROUP)
|
||||||
B_DEFINE_HPKG_ATTRIBUTE(52, STRING, "package:post-install-script",
|
B_DEFINE_HPKG_ATTRIBUTE(52, STRING, "package:post-install-script",
|
||||||
PACKAGE_POST_INSTALL_SCRIPT)
|
PACKAGE_POST_INSTALL_SCRIPT)
|
||||||
|
B_DEFINE_HPKG_ATTRIBUTE(53, UINT, "package:is-writable-directory",
|
||||||
|
PACKAGE_IS_WRITABLE_DIRECTORY)
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
#include <package/PackageArchitecture.h>
|
#include <package/PackageArchitecture.h>
|
||||||
#include <package/PackageInfoAttributes.h>
|
#include <package/PackageInfoAttributes.h>
|
||||||
#include <package/PackageResolvableOperator.h>
|
#include <package/PackageResolvableOperator.h>
|
||||||
#include <package/SettingsFileUpdateType.h>
|
#include <package/WritableFileUpdateType.h>
|
||||||
|
|
||||||
|
|
||||||
namespace BPackageKit {
|
namespace BPackageKit {
|
||||||
@@ -47,15 +47,17 @@ struct BPackageResolvableExpressionData {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
struct BGlobalSettingsFileInfoData {
|
struct BGlobalWritableFileInfoData {
|
||||||
const char* path;
|
const char* path;
|
||||||
BSettingsFileUpdateType updateType;
|
BWritableFileUpdateType updateType;
|
||||||
|
bool isDirectory;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
struct BUserSettingsFileInfoData {
|
struct BUserSettingsFileInfoData {
|
||||||
const char* path;
|
const char* path;
|
||||||
const char* templatePath;
|
const char* templatePath;
|
||||||
|
bool isDirectory;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -76,7 +78,7 @@ struct BPackageInfoAttributeValue {
|
|||||||
BPackageVersionData version;
|
BPackageVersionData version;
|
||||||
BPackageResolvableData resolvable;
|
BPackageResolvableData resolvable;
|
||||||
BPackageResolvableExpressionData resolvableExpression;
|
BPackageResolvableExpressionData resolvableExpression;
|
||||||
BGlobalSettingsFileInfoData globalSettingsFileInfo;
|
BGlobalWritableFileInfoData globalWritableFileInfo;
|
||||||
BUserSettingsFileInfoData userSettingsFileInfo;
|
BUserSettingsFileInfoData userSettingsFileInfo;
|
||||||
BUserData user;
|
BUserData user;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ protected:
|
|||||||
class PackageVersionAttributeHandler;
|
class PackageVersionAttributeHandler;
|
||||||
class PackageResolvableAttributeHandler;
|
class PackageResolvableAttributeHandler;
|
||||||
class PackageResolvableExpressionAttributeHandler;
|
class PackageResolvableExpressionAttributeHandler;
|
||||||
class GlobalSettingsFileInfoAttributeHandler;
|
class GlobalWritableFileInfoAttributeHandler;
|
||||||
class UserSettingsFileInfoAttributeHandler;
|
class UserSettingsFileInfoAttributeHandler;
|
||||||
class UserAttributeHandler;
|
class UserAttributeHandler;
|
||||||
class PackageAttributeHandler;
|
class PackageAttributeHandler;
|
||||||
@@ -318,10 +318,10 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class ReaderImplBase::GlobalSettingsFileInfoAttributeHandler
|
class ReaderImplBase::GlobalWritableFileInfoAttributeHandler
|
||||||
: public PackageInfoAttributeHandlerBase {
|
: public PackageInfoAttributeHandlerBase {
|
||||||
public:
|
public:
|
||||||
GlobalSettingsFileInfoAttributeHandler(
|
GlobalWritableFileInfoAttributeHandler(
|
||||||
BPackageInfoAttributeValue&
|
BPackageInfoAttributeValue&
|
||||||
packageInfoValue);
|
packageInfoValue);
|
||||||
|
|
||||||
|
|||||||
@@ -288,14 +288,16 @@ struct PackageContentListHandler : VersionPolicy::PackageContentHandler {
|
|||||||
printf("\treplaces: %s\n", value.string);
|
printf("\treplaces: %s\n", value.string);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case B_PACKAGE_INFO_GLOBAL_SETTINGS_FILES:
|
case B_PACKAGE_INFO_GLOBAL_WRITABLE_FILES:
|
||||||
printf("\tglobal settings file: %s",
|
printf("\tglobal writable file: %s",
|
||||||
value.globalSettingsFileInfo.path);
|
value.globalWritableFileInfo.path);
|
||||||
if (value.globalSettingsFileInfo.updateType
|
if (value.globalWritableFileInfo.isDirectory)
|
||||||
< B_SETTINGS_FILE_UPDATE_TYPE_ENUM_COUNT) {
|
printf( " directory");
|
||||||
|
if (value.globalWritableFileInfo.updateType
|
||||||
|
< B_WRITABLE_FILE_UPDATE_TYPE_ENUM_COUNT) {
|
||||||
printf(" %s\n",
|
printf(" %s\n",
|
||||||
BPackageInfo::kSettingsFileUpdateTypes[
|
BPackageInfo::kWritableFileUpdateTypes[
|
||||||
value.globalSettingsFileInfo.updateType]);
|
value.globalWritableFileInfo.updateType]);
|
||||||
} else
|
} else
|
||||||
printf("\n");
|
printf("\n");
|
||||||
break;
|
break;
|
||||||
@@ -303,7 +305,9 @@ struct PackageContentListHandler : VersionPolicy::PackageContentHandler {
|
|||||||
case B_PACKAGE_INFO_USER_SETTINGS_FILES:
|
case B_PACKAGE_INFO_USER_SETTINGS_FILES:
|
||||||
printf("\tuser settings file: %s",
|
printf("\tuser settings file: %s",
|
||||||
value.userSettingsFileInfo.path);
|
value.userSettingsFileInfo.path);
|
||||||
if (value.userSettingsFileInfo.templatePath != NULL) {
|
if (value.globalWritableFileInfo.isDirectory) {
|
||||||
|
printf( " directory\n");
|
||||||
|
} else if (value.userSettingsFileInfo.templatePath != NULL) {
|
||||||
printf(" template %s\n",
|
printf(" template %s\n",
|
||||||
value.userSettingsFileInfo.templatePath);
|
value.userSettingsFileInfo.templatePath);
|
||||||
} else
|
} else
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ HPKG_SOURCES =
|
|||||||
DataWriters.cpp
|
DataWriters.cpp
|
||||||
ErrorOutput.cpp
|
ErrorOutput.cpp
|
||||||
FDDataReader.cpp
|
FDDataReader.cpp
|
||||||
GlobalSettingsFileInfo.cpp
|
GlobalWritableFileInfo.cpp
|
||||||
HPKGDefs.cpp
|
HPKGDefs.cpp
|
||||||
PackageContentHandler.cpp
|
PackageContentHandler.cpp
|
||||||
PackageData.cpp
|
PackageData.cpp
|
||||||
|
|||||||
@@ -1,85 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2013, Ingo Weinhold, ingo_weinhold@gmx.de.
|
|
||||||
* Distributed under the terms of the MIT License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#include <package/GlobalSettingsFileInfo.h>
|
|
||||||
|
|
||||||
#include <package/hpkg/PackageInfoAttributeValue.h>
|
|
||||||
|
|
||||||
|
|
||||||
namespace BPackageKit {
|
|
||||||
|
|
||||||
|
|
||||||
BGlobalSettingsFileInfo::BGlobalSettingsFileInfo()
|
|
||||||
:
|
|
||||||
fPath(),
|
|
||||||
fUpdateType(B_SETTINGS_FILE_UPDATE_TYPE_ENUM_COUNT)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
BGlobalSettingsFileInfo::BGlobalSettingsFileInfo(
|
|
||||||
const BHPKG::BGlobalSettingsFileInfoData& infoData)
|
|
||||||
:
|
|
||||||
fPath(infoData.path),
|
|
||||||
fUpdateType(infoData.updateType)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
BGlobalSettingsFileInfo::BGlobalSettingsFileInfo(const BString& path,
|
|
||||||
BSettingsFileUpdateType updateType)
|
|
||||||
:
|
|
||||||
fPath(path),
|
|
||||||
fUpdateType(updateType)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
BGlobalSettingsFileInfo::~BGlobalSettingsFileInfo()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
status_t
|
|
||||||
BGlobalSettingsFileInfo::InitCheck() const
|
|
||||||
{
|
|
||||||
if (fPath.IsEmpty())
|
|
||||||
return B_NO_INIT;
|
|
||||||
return B_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const BString&
|
|
||||||
BGlobalSettingsFileInfo::Path() const
|
|
||||||
{
|
|
||||||
return fPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
BGlobalSettingsFileInfo::IsIncluded() const
|
|
||||||
{
|
|
||||||
return fUpdateType != B_SETTINGS_FILE_UPDATE_TYPE_ENUM_COUNT;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
BSettingsFileUpdateType
|
|
||||||
BGlobalSettingsFileInfo::UpdateType() const
|
|
||||||
{
|
|
||||||
return fUpdateType;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
BGlobalSettingsFileInfo::SetTo(const BString& path,
|
|
||||||
BSettingsFileUpdateType updateType)
|
|
||||||
{
|
|
||||||
fPath = path;
|
|
||||||
fUpdateType = updateType;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
} // namespace BPackageKit
|
|
||||||
@@ -0,0 +1,95 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2013, Ingo Weinhold, ingo_weinhold@gmx.de.
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include <package/GlobalWritableFileInfo.h>
|
||||||
|
|
||||||
|
#include <package/hpkg/PackageInfoAttributeValue.h>
|
||||||
|
|
||||||
|
|
||||||
|
namespace BPackageKit {
|
||||||
|
|
||||||
|
|
||||||
|
BGlobalWritableFileInfo::BGlobalWritableFileInfo()
|
||||||
|
:
|
||||||
|
fPath(),
|
||||||
|
fUpdateType(B_WRITABLE_FILE_UPDATE_TYPE_ENUM_COUNT)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BGlobalWritableFileInfo::BGlobalWritableFileInfo(
|
||||||
|
const BHPKG::BGlobalWritableFileInfoData& infoData)
|
||||||
|
:
|
||||||
|
fPath(infoData.path),
|
||||||
|
fUpdateType(infoData.updateType),
|
||||||
|
fIsDirectory(infoData.isDirectory)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BGlobalWritableFileInfo::BGlobalWritableFileInfo(const BString& path,
|
||||||
|
BWritableFileUpdateType updateType, bool isDirectory)
|
||||||
|
:
|
||||||
|
fPath(path),
|
||||||
|
fUpdateType(updateType),
|
||||||
|
fIsDirectory(isDirectory)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BGlobalWritableFileInfo::~BGlobalWritableFileInfo()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
BGlobalWritableFileInfo::InitCheck() const
|
||||||
|
{
|
||||||
|
if (fPath.IsEmpty())
|
||||||
|
return B_NO_INIT;
|
||||||
|
return B_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const BString&
|
||||||
|
BGlobalWritableFileInfo::Path() const
|
||||||
|
{
|
||||||
|
return fPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
BGlobalWritableFileInfo::IsIncluded() const
|
||||||
|
{
|
||||||
|
return fUpdateType != B_WRITABLE_FILE_UPDATE_TYPE_ENUM_COUNT;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BWritableFileUpdateType
|
||||||
|
BGlobalWritableFileInfo::UpdateType() const
|
||||||
|
{
|
||||||
|
return fUpdateType;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
BGlobalWritableFileInfo::IsDirectory() const
|
||||||
|
{
|
||||||
|
return fIsDirectory;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
BGlobalWritableFileInfo::SetTo(const BString& path,
|
||||||
|
BWritableFileUpdateType updateType, bool isDirectory)
|
||||||
|
{
|
||||||
|
fPath = path;
|
||||||
|
fUpdateType = updateType;
|
||||||
|
fIsDirectory = isDirectory;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace BPackageKit
|
||||||
@@ -21,7 +21,7 @@ HPKG_SOURCES =
|
|||||||
DataWriters.cpp
|
DataWriters.cpp
|
||||||
ErrorOutput.cpp
|
ErrorOutput.cpp
|
||||||
FDDataReader.cpp
|
FDDataReader.cpp
|
||||||
GlobalSettingsFileInfo.cpp
|
GlobalWritableFileInfo.cpp
|
||||||
HPKGDefs.cpp
|
HPKGDefs.cpp
|
||||||
PackageContentHandler.cpp
|
PackageContentHandler.cpp
|
||||||
PackageData.cpp
|
PackageData.cpp
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ const char* const BPackageInfo::kElementNames[B_PACKAGE_INFO_ENUM_COUNT] = {
|
|||||||
"checksum", // not being parsed, computed externally
|
"checksum", // not being parsed, computed externally
|
||||||
NULL, // install-path -- not settable via .PackageInfo
|
NULL, // install-path -- not settable via .PackageInfo
|
||||||
"base-package",
|
"base-package",
|
||||||
"global-settings-files",
|
"global-writable-files",
|
||||||
"user-settings-files",
|
"user-settings-files",
|
||||||
"users",
|
"users",
|
||||||
"groups",
|
"groups",
|
||||||
@@ -68,8 +68,8 @@ BPackageInfo::kArchitectureNames[B_PACKAGE_ARCHITECTURE_ENUM_COUNT] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
const char* const BPackageInfo::kSettingsFileUpdateTypes[
|
const char* const BPackageInfo::kWritableFileUpdateTypes[
|
||||||
B_SETTINGS_FILE_UPDATE_TYPE_ENUM_COUNT] = {
|
B_WRITABLE_FILE_UPDATE_TYPE_ENUM_COUNT] = {
|
||||||
"keep-old",
|
"keep-old",
|
||||||
"manual",
|
"manual",
|
||||||
"auto-merge",
|
"auto-merge",
|
||||||
@@ -168,7 +168,7 @@ BPackageInfo::BPackageInfo()
|
|||||||
fLicenseList(4),
|
fLicenseList(4),
|
||||||
fURLList(4),
|
fURLList(4),
|
||||||
fSourceURLList(4),
|
fSourceURLList(4),
|
||||||
fGlobalSettingsFileInfos(4, true),
|
fGlobalWritableFileInfos(4, true),
|
||||||
fUserSettingsFileInfos(4, true),
|
fUserSettingsFileInfos(4, true),
|
||||||
fUsers(4, true),
|
fUsers(4, true),
|
||||||
fGroups(4),
|
fGroups(4),
|
||||||
@@ -192,7 +192,7 @@ BPackageInfo::BPackageInfo(BMessage* archive, status_t* _error)
|
|||||||
fLicenseList(4),
|
fLicenseList(4),
|
||||||
fURLList(4),
|
fURLList(4),
|
||||||
fSourceURLList(4),
|
fSourceURLList(4),
|
||||||
fGlobalSettingsFileInfos(4, true),
|
fGlobalWritableFileInfos(4, true),
|
||||||
fUserSettingsFileInfos(4, true),
|
fUserSettingsFileInfos(4, true),
|
||||||
fUsers(4, true),
|
fUsers(4, true),
|
||||||
fGroups(4),
|
fGroups(4),
|
||||||
@@ -222,8 +222,8 @@ BPackageInfo::BPackageInfo(BMessage* archive, status_t* _error)
|
|||||||
&& (error = _ExtractStringList(archive, "urls", fURLList)) == B_OK
|
&& (error = _ExtractStringList(archive, "urls", fURLList)) == B_OK
|
||||||
&& (error = _ExtractStringList(archive, "source-urls", fSourceURLList))
|
&& (error = _ExtractStringList(archive, "source-urls", fSourceURLList))
|
||||||
== B_OK
|
== B_OK
|
||||||
&& (error = _ExtractGlobalSettingsFileInfos(archive,
|
&& (error = _ExtractGlobalWritableFileInfos(archive,
|
||||||
"global-settings-files", fGlobalSettingsFileInfos)) == B_OK
|
"global-writable-files", fGlobalWritableFileInfos)) == B_OK
|
||||||
&& (error = _ExtractUserSettingsFileInfos(archive, "user-settings-files",
|
&& (error = _ExtractUserSettingsFileInfos(archive, "user-settings-files",
|
||||||
fUserSettingsFileInfos)) == B_OK
|
fUserSettingsFileInfos)) == B_OK
|
||||||
&& (error = _ExtractUsers(archive, "users", fUsers)) == B_OK
|
&& (error = _ExtractUsers(archive, "users", fUsers)) == B_OK
|
||||||
@@ -340,11 +340,11 @@ BPackageInfo::InitCheck() const
|
|||||||
|| fProvidesList.IsEmpty())
|
|| fProvidesList.IsEmpty())
|
||||||
return B_NO_INIT;
|
return B_NO_INIT;
|
||||||
|
|
||||||
// check global settings files
|
// check global writable files
|
||||||
int32 globalSettingsFileCount = fGlobalSettingsFileInfos.CountItems();
|
int32 globalWritableFileCount = fGlobalWritableFileInfos.CountItems();
|
||||||
for (int32 i = 0; i < globalSettingsFileCount; i++) {
|
for (int32 i = 0; i < globalWritableFileCount; i++) {
|
||||||
const BGlobalSettingsFileInfo* info
|
const BGlobalWritableFileInfo* info
|
||||||
= fGlobalSettingsFileInfos.ItemAt(i);
|
= fGlobalWritableFileInfos.ItemAt(i);
|
||||||
status_t error = info->InitCheck();
|
status_t error = info->InitCheck();
|
||||||
if (error != B_OK)
|
if (error != B_OK)
|
||||||
return error;
|
return error;
|
||||||
@@ -493,10 +493,10 @@ BPackageInfo::SourceURLList() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const BObjectList<BGlobalSettingsFileInfo>&
|
const BObjectList<BGlobalWritableFileInfo>&
|
||||||
BPackageInfo::GlobalSettingsFileInfos() const
|
BPackageInfo::GlobalWritableFileInfos() const
|
||||||
{
|
{
|
||||||
return fGlobalSettingsFileInfos;
|
return fGlobalWritableFileInfos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -716,18 +716,18 @@ BPackageInfo::AddSourceURL(const BString& url)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BPackageInfo::ClearGlobalSettingsFileInfos()
|
BPackageInfo::ClearGlobalWritableFileInfos()
|
||||||
{
|
{
|
||||||
fGlobalSettingsFileInfos.MakeEmpty();
|
fGlobalWritableFileInfos.MakeEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
BPackageInfo::AddGlobalSettingsFileInfo(const BGlobalSettingsFileInfo& info)
|
BPackageInfo::AddGlobalWritableFileInfo(const BGlobalWritableFileInfo& info)
|
||||||
{
|
{
|
||||||
BGlobalSettingsFileInfo* newInfo
|
BGlobalWritableFileInfo* newInfo
|
||||||
= new (std::nothrow) BGlobalSettingsFileInfo(info);
|
= new (std::nothrow) BGlobalWritableFileInfo(info);
|
||||||
if (newInfo == NULL || !fGlobalSettingsFileInfos.AddItem(newInfo)) {
|
if (newInfo == NULL || !fGlobalWritableFileInfos.AddItem(newInfo)) {
|
||||||
delete newInfo;
|
delete newInfo;
|
||||||
return B_NO_MEMORY;
|
return B_NO_MEMORY;
|
||||||
}
|
}
|
||||||
@@ -932,7 +932,7 @@ BPackageInfo::Clear()
|
|||||||
fLicenseList.MakeEmpty();
|
fLicenseList.MakeEmpty();
|
||||||
fURLList.MakeEmpty();
|
fURLList.MakeEmpty();
|
||||||
fSourceURLList.MakeEmpty();
|
fSourceURLList.MakeEmpty();
|
||||||
fGlobalSettingsFileInfos.MakeEmpty();
|
fGlobalWritableFileInfos.MakeEmpty();
|
||||||
fUserSettingsFileInfos.MakeEmpty();
|
fUserSettingsFileInfos.MakeEmpty();
|
||||||
fUsers.MakeEmpty();
|
fUsers.MakeEmpty();
|
||||||
fGroups.MakeEmpty();
|
fGroups.MakeEmpty();
|
||||||
@@ -968,8 +968,8 @@ BPackageInfo::Archive(BMessage* archive, bool deep) const
|
|||||||
|| (error = archive->AddStrings("urls", fURLList)) != B_OK
|
|| (error = archive->AddStrings("urls", fURLList)) != B_OK
|
||||||
|| (error = archive->AddStrings("source-urls", fSourceURLList))
|
|| (error = archive->AddStrings("source-urls", fSourceURLList))
|
||||||
!= B_OK
|
!= B_OK
|
||||||
|| (error = _AddGlobalSettingsFileInfos(archive,
|
|| (error = _AddGlobalWritableFileInfos(archive,
|
||||||
"global-settings-files", fGlobalSettingsFileInfos)) != B_OK
|
"global-writable-files", fGlobalWritableFileInfos)) != B_OK
|
||||||
|| (error = _AddUserSettingsFileInfos(archive,
|
|| (error = _AddUserSettingsFileInfos(archive,
|
||||||
"user-settings-files", fUserSettingsFileInfos)) != B_OK
|
"user-settings-files", fUserSettingsFileInfos)) != B_OK
|
||||||
|| (error = _AddUsers(archive, "users", fUsers)) != B_OK
|
|| (error = _AddUsers(archive, "users", fUsers)) != B_OK
|
||||||
@@ -1019,7 +1019,7 @@ BPackageInfo::GetConfigString(BString& _string) const
|
|||||||
.Write("licenses", fLicenseList)
|
.Write("licenses", fLicenseList)
|
||||||
.Write("urls", fURLList)
|
.Write("urls", fURLList)
|
||||||
.Write("source-urls", fSourceURLList)
|
.Write("source-urls", fSourceURLList)
|
||||||
.Write("global-settings-files", fGlobalSettingsFileInfos)
|
.Write("global-writable-files", fGlobalWritableFileInfos)
|
||||||
.Write("user-settings-files", fUserSettingsFileInfos)
|
.Write("user-settings-files", fUserSettingsFileInfos)
|
||||||
.Write("users", fUsers)
|
.Write("users", fUsers)
|
||||||
.Write("groups", fGroups)
|
.Write("groups", fGroups)
|
||||||
@@ -1219,24 +1219,29 @@ BPackageInfo::_AddResolvableExpressions(BMessage* archive, const char* field,
|
|||||||
|
|
||||||
|
|
||||||
/*static*/ status_t
|
/*static*/ status_t
|
||||||
BPackageInfo::_AddGlobalSettingsFileInfos(BMessage* archive, const char* field,
|
BPackageInfo::_AddGlobalWritableFileInfos(BMessage* archive, const char* field,
|
||||||
const GlobalSettingsFileInfoList& infos)
|
const GlobalWritableFileInfoList& infos)
|
||||||
{
|
{
|
||||||
// construct the field names we need
|
// construct the field names we need
|
||||||
FieldName pathField(field, ":path");
|
FieldName pathField(field, ":path");
|
||||||
FieldName updateTypeField(field, ":version");
|
FieldName updateTypeField(field, ":updateType");
|
||||||
|
FieldName isDirectoryField(field, ":isDirectory");
|
||||||
|
|
||||||
if (!pathField.IsValid() || !updateTypeField.IsValid())
|
if (!pathField.IsValid() || !updateTypeField.IsValid()
|
||||||
|
|| !isDirectoryField.IsValid()) {
|
||||||
return B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
|
}
|
||||||
|
|
||||||
// add fields
|
// add fields
|
||||||
int32 count = infos.CountItems();
|
int32 count = infos.CountItems();
|
||||||
for (int32 i = 0; i < count; i++) {
|
for (int32 i = 0; i < count; i++) {
|
||||||
const BGlobalSettingsFileInfo* info = infos.ItemAt(i);
|
const BGlobalWritableFileInfo* info = infos.ItemAt(i);
|
||||||
status_t error;
|
status_t error;
|
||||||
if ((error = archive->AddString(pathField, info->Path())) != B_OK
|
if ((error = archive->AddString(pathField, info->Path())) != B_OK
|
||||||
|| (error = archive->AddInt32(updateTypeField, info->UpdateType()))
|
|| (error = archive->AddInt32(updateTypeField, info->UpdateType()))
|
||||||
!= B_OK) {
|
!= B_OK
|
||||||
|
|| (error = archive->AddBool(isDirectoryField,
|
||||||
|
info->IsDirectory())) != B_OK) {
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1252,9 +1257,12 @@ BPackageInfo::_AddUserSettingsFileInfos(BMessage* archive, const char* field,
|
|||||||
// construct the field names we need
|
// construct the field names we need
|
||||||
FieldName pathField(field, ":path");
|
FieldName pathField(field, ":path");
|
||||||
FieldName templatePathField(field, ":templatePath");
|
FieldName templatePathField(field, ":templatePath");
|
||||||
|
FieldName isDirectoryField(field, ":isDirectory");
|
||||||
|
|
||||||
if (!pathField.IsValid() || !templatePathField.IsValid())
|
if (!pathField.IsValid() || !templatePathField.IsValid()
|
||||||
|
|| !isDirectoryField.IsValid()) {
|
||||||
return B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
|
}
|
||||||
|
|
||||||
// add fields
|
// add fields
|
||||||
int32 count = infos.CountItems();
|
int32 count = infos.CountItems();
|
||||||
@@ -1263,7 +1271,9 @@ BPackageInfo::_AddUserSettingsFileInfos(BMessage* archive, const char* field,
|
|||||||
status_t error;
|
status_t error;
|
||||||
if ((error = archive->AddString(pathField, info->Path())) != B_OK
|
if ((error = archive->AddString(pathField, info->Path())) != B_OK
|
||||||
|| (error = archive->AddString(templatePathField,
|
|| (error = archive->AddString(templatePathField,
|
||||||
info->TemplatePath())) != B_OK) {
|
info->TemplatePath())) != B_OK
|
||||||
|
|| (error = archive->AddBool(isDirectoryField,
|
||||||
|
info->IsDirectory())) != B_OK) {
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1486,15 +1496,18 @@ BPackageInfo::_ExtractResolvableExpressions(BMessage* archive,
|
|||||||
|
|
||||||
|
|
||||||
/*static*/ status_t
|
/*static*/ status_t
|
||||||
BPackageInfo::_ExtractGlobalSettingsFileInfos(BMessage* archive,
|
BPackageInfo::_ExtractGlobalWritableFileInfos(BMessage* archive,
|
||||||
const char* field, GlobalSettingsFileInfoList& _infos)
|
const char* field, GlobalWritableFileInfoList& _infos)
|
||||||
{
|
{
|
||||||
// construct the field names we need
|
// construct the field names we need
|
||||||
FieldName pathField(field, ":path");
|
FieldName pathField(field, ":path");
|
||||||
FieldName updateTypeField(field, ":version");
|
FieldName updateTypeField(field, ":updateType");
|
||||||
|
FieldName isDirectoryField(field, ":isDirectory");
|
||||||
|
|
||||||
if (!pathField.IsValid() || !updateTypeField.IsValid())
|
if (!pathField.IsValid() || !updateTypeField.IsValid()
|
||||||
|
|| !isDirectoryField.IsValid()) {
|
||||||
return B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
|
}
|
||||||
|
|
||||||
// get the number of items
|
// get the number of items
|
||||||
type_code type;
|
type_code type;
|
||||||
@@ -1516,13 +1529,18 @@ BPackageInfo::_ExtractGlobalSettingsFileInfos(BMessage* archive,
|
|||||||
if (error != B_OK)
|
if (error != B_OK)
|
||||||
return error;
|
return error;
|
||||||
if (updateType < 0
|
if (updateType < 0
|
||||||
|| updateType > B_SETTINGS_FILE_UPDATE_TYPE_ENUM_COUNT) {
|
|| updateType > B_WRITABLE_FILE_UPDATE_TYPE_ENUM_COUNT) {
|
||||||
return B_BAD_DATA;
|
return B_BAD_DATA;
|
||||||
}
|
}
|
||||||
|
|
||||||
BGlobalSettingsFileInfo* info
|
bool isDirectory;
|
||||||
= new(std::nothrow) BGlobalSettingsFileInfo(path,
|
error = archive->FindBool(isDirectoryField, i, &isDirectory);
|
||||||
(BSettingsFileUpdateType)updateType);
|
if (error != B_OK)
|
||||||
|
return error;
|
||||||
|
|
||||||
|
BGlobalWritableFileInfo* info
|
||||||
|
= new(std::nothrow) BGlobalWritableFileInfo(path,
|
||||||
|
(BWritableFileUpdateType)updateType, isDirectory);
|
||||||
if (info == NULL || !_infos.AddItem(info)) {
|
if (info == NULL || !_infos.AddItem(info)) {
|
||||||
delete info;
|
delete info;
|
||||||
return B_NO_MEMORY;
|
return B_NO_MEMORY;
|
||||||
@@ -1540,9 +1558,12 @@ BPackageInfo::_ExtractUserSettingsFileInfos(BMessage* archive,
|
|||||||
// construct the field names we need
|
// construct the field names we need
|
||||||
FieldName pathField(field, ":path");
|
FieldName pathField(field, ":path");
|
||||||
FieldName templatePathField(field, ":templatePath");
|
FieldName templatePathField(field, ":templatePath");
|
||||||
|
FieldName isDirectoryField(field, ":isDirectory");
|
||||||
|
|
||||||
if (!pathField.IsValid() || !templatePathField.IsValid())
|
if (!pathField.IsValid() || !templatePathField.IsValid()
|
||||||
|
|| !isDirectoryField.IsValid()) {
|
||||||
return B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
|
}
|
||||||
|
|
||||||
// get the number of items
|
// get the number of items
|
||||||
type_code type;
|
type_code type;
|
||||||
@@ -1564,8 +1585,14 @@ BPackageInfo::_ExtractUserSettingsFileInfos(BMessage* archive,
|
|||||||
if (error != B_OK)
|
if (error != B_OK)
|
||||||
return error;
|
return error;
|
||||||
|
|
||||||
BUserSettingsFileInfo* info
|
bool isDirectory;
|
||||||
= new(std::nothrow) BUserSettingsFileInfo(path, templatePath);
|
error = archive->FindBool(isDirectoryField, i, &isDirectory);
|
||||||
|
if (error != B_OK)
|
||||||
|
return error;
|
||||||
|
|
||||||
|
BUserSettingsFileInfo* info = isDirectory
|
||||||
|
? new(std::nothrow) BUserSettingsFileInfo(path, true)
|
||||||
|
: new(std::nothrow) BUserSettingsFileInfo(path, templatePath);
|
||||||
if (info == NULL || !_infos.AddItem(info)) {
|
if (info == NULL || !_infos.AddItem(info)) {
|
||||||
delete info;
|
delete info;
|
||||||
return B_NO_MEMORY;
|
return B_NO_MEMORY;
|
||||||
|
|||||||
@@ -143,9 +143,9 @@ BPackageInfoContentHandler::HandlePackageAttribute(
|
|||||||
fPackageInfo.SetBasePackage(value.string);
|
fPackageInfo.SetBasePackage(value.string);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case B_PACKAGE_INFO_GLOBAL_SETTINGS_FILES:
|
case B_PACKAGE_INFO_GLOBAL_WRITABLE_FILES:
|
||||||
fPackageInfo.AddGlobalSettingsFileInfo(
|
fPackageInfo.AddGlobalWritableFileInfo(
|
||||||
value.globalSettingsFileInfo);
|
value.globalWritableFileInfo);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case B_PACKAGE_INFO_USER_SETTINGS_FILES:
|
case B_PACKAGE_INFO_USER_SETTINGS_FILES:
|
||||||
|
|||||||
@@ -604,15 +604,15 @@ BPackageInfo::Parser::_ParseResolvableExprList(
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BPackageInfo::Parser::_ParseGlobalSettingsFileInfos(
|
BPackageInfo::Parser::_ParseGlobalWritableFileInfos(
|
||||||
GlobalSettingsFileInfoList* infos)
|
GlobalWritableFileInfoList* infos)
|
||||||
{
|
{
|
||||||
struct GlobalSettingsFileInfoParser : public ListElementParser {
|
struct GlobalWritableFileInfoParser : public ListElementParser {
|
||||||
Parser& parser;
|
Parser& parser;
|
||||||
GlobalSettingsFileInfoList* infos;
|
GlobalWritableFileInfoList* infos;
|
||||||
|
|
||||||
GlobalSettingsFileInfoParser(Parser& parser,
|
GlobalWritableFileInfoParser(Parser& parser,
|
||||||
GlobalSettingsFileInfoList* infos)
|
GlobalWritableFileInfoList* infos)
|
||||||
:
|
:
|
||||||
parser(parser),
|
parser(parser),
|
||||||
infos(infos)
|
infos(infos)
|
||||||
@@ -626,21 +626,27 @@ BPackageInfo::Parser::_ParseGlobalSettingsFileInfos(
|
|||||||
token.pos);
|
token.pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
BSettingsFileUpdateType updateType
|
BWritableFileUpdateType updateType
|
||||||
= B_SETTINGS_FILE_UPDATE_TYPE_ENUM_COUNT;
|
= B_WRITABLE_FILE_UPDATE_TYPE_ENUM_COUNT;
|
||||||
|
bool isDirectory = false;
|
||||||
|
|
||||||
Token nextToken = parser._NextToken();
|
Token nextToken = parser._NextToken();
|
||||||
|
if (nextToken.type == TOKEN_WORD && nextToken.text == "directory") {
|
||||||
|
isDirectory = true;
|
||||||
|
nextToken = parser._NextToken();
|
||||||
|
}
|
||||||
|
|
||||||
if (nextToken.type == TOKEN_WORD) {
|
if (nextToken.type == TOKEN_WORD) {
|
||||||
const char* const* end = kSettingsFileUpdateTypes
|
const char* const* end = kWritableFileUpdateTypes
|
||||||
+ B_SETTINGS_FILE_UPDATE_TYPE_ENUM_COUNT;
|
+ B_WRITABLE_FILE_UPDATE_TYPE_ENUM_COUNT;
|
||||||
const char* const* found = std::find(kSettingsFileUpdateTypes,
|
const char* const* found = std::find(kWritableFileUpdateTypes,
|
||||||
end, nextToken.text);
|
end, nextToken.text);
|
||||||
if (found == end) {
|
if (found == end) {
|
||||||
throw ParseError(BString("expected an update type"),
|
throw ParseError(BString("expected an update type"),
|
||||||
nextToken.pos);
|
nextToken.pos);
|
||||||
}
|
}
|
||||||
updateType = (BSettingsFileUpdateType)(
|
updateType = (BWritableFileUpdateType)(
|
||||||
found - kSettingsFileUpdateTypes);
|
found - kWritableFileUpdateTypes);
|
||||||
} else if (nextToken.type == TOKEN_ITEM_SEPARATOR
|
} else if (nextToken.type == TOKEN_ITEM_SEPARATOR
|
||||||
|| nextToken.type == TOKEN_CLOSE_BRACE) {
|
|| nextToken.type == TOKEN_CLOSE_BRACE) {
|
||||||
parser._RewindTo(nextToken);
|
parser._RewindTo(nextToken);
|
||||||
@@ -650,8 +656,8 @@ BPackageInfo::Parser::_ParseGlobalSettingsFileInfos(
|
|||||||
nextToken.pos);
|
nextToken.pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!infos->AddItem(new BGlobalSettingsFileInfo(token.text,
|
if (!infos->AddItem(new BGlobalWritableFileInfo(token.text,
|
||||||
updateType))) {
|
updateType, isDirectory))) {
|
||||||
throw std::bad_alloc();
|
throw std::bad_alloc();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -685,9 +691,13 @@ BPackageInfo::Parser::_ParseUserSettingsFileInfos(
|
|||||||
}
|
}
|
||||||
|
|
||||||
BString templatePath;
|
BString templatePath;
|
||||||
|
bool isDirectory = false;
|
||||||
|
|
||||||
Token nextToken = parser._NextToken();
|
Token nextToken = parser._NextToken();
|
||||||
if (nextToken.type == TOKEN_WORD && nextToken.text == "template") {
|
if (nextToken.type == TOKEN_WORD && nextToken.text == "directory") {
|
||||||
|
isDirectory = true;
|
||||||
|
} else if (nextToken.type == TOKEN_WORD
|
||||||
|
&& nextToken.text == "template") {
|
||||||
nextToken = parser._NextToken();
|
nextToken = parser._NextToken();
|
||||||
if (nextToken.type != TOKEN_WORD
|
if (nextToken.type != TOKEN_WORD
|
||||||
&& nextToken.type != TOKEN_QUOTED_STRING) {
|
&& nextToken.type != TOKEN_QUOTED_STRING) {
|
||||||
@@ -705,8 +715,10 @@ BPackageInfo::Parser::_ParseUserSettingsFileInfos(
|
|||||||
nextToken.pos);
|
nextToken.pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!infos->AddItem(new BUserSettingsFileInfo(token.text,
|
if (isDirectory
|
||||||
templatePath))) {
|
? !infos->AddItem(new BUserSettingsFileInfo(token.text, true))
|
||||||
|
: !infos->AddItem(new BUserSettingsFileInfo(token.text,
|
||||||
|
templatePath))) {
|
||||||
throw std::bad_alloc();
|
throw std::bad_alloc();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -929,9 +941,9 @@ BPackageInfo::Parser::_Parse(BPackageInfo* packageInfo)
|
|||||||
_ParseStringList(&packageInfo->fSourceURLList);
|
_ParseStringList(&packageInfo->fSourceURLList);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case B_PACKAGE_INFO_GLOBAL_SETTINGS_FILES:
|
case B_PACKAGE_INFO_GLOBAL_WRITABLE_FILES:
|
||||||
_ParseGlobalSettingsFileInfos(
|
_ParseGlobalWritableFileInfos(
|
||||||
&packageInfo->fGlobalSettingsFileInfos);
|
&packageInfo->fGlobalWritableFileInfos);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case B_PACKAGE_INFO_USER_SETTINGS_FILES:
|
case B_PACKAGE_INFO_USER_SETTINGS_FILES:
|
||||||
|
|||||||
@@ -75,8 +75,8 @@ private:
|
|||||||
BObjectList<BPackageResolvableExpression>*
|
BObjectList<BPackageResolvableExpression>*
|
||||||
value,
|
value,
|
||||||
BString* _basePackage = NULL);
|
BString* _basePackage = NULL);
|
||||||
void _ParseGlobalSettingsFileInfos(
|
void _ParseGlobalWritableFileInfos(
|
||||||
GlobalSettingsFileInfoList* infos);
|
GlobalWritableFileInfoList* infos);
|
||||||
void _ParseUserSettingsFileInfos(
|
void _ParseUserSettingsFileInfos(
|
||||||
UserSettingsFileInfoList* infos);
|
UserSettingsFileInfoList* infos);
|
||||||
void _ParseUsers(UserList* users);
|
void _ParseUsers(UserList* users);
|
||||||
|
|||||||
@@ -157,19 +157,25 @@ private:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void _WriteListElement(const BGlobalSettingsFileInfo* value)
|
void _WriteListElement(const BGlobalWritableFileInfo* value)
|
||||||
{
|
{
|
||||||
_WriteMaybeQuoted(value->Path());
|
_WriteMaybeQuoted(value->Path());
|
||||||
|
if (value->IsDirectory()) {
|
||||||
|
_Write(' ');
|
||||||
|
_Write("directory");
|
||||||
|
}
|
||||||
if (value->IsIncluded()) {
|
if (value->IsIncluded()) {
|
||||||
_Write(' ');
|
_Write(' ');
|
||||||
_Write(kSettingsFileUpdateTypes[value->UpdateType()]);
|
_Write(kWritableFileUpdateTypes[value->UpdateType()]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void _WriteListElement(const BUserSettingsFileInfo* value)
|
void _WriteListElement(const BUserSettingsFileInfo* value)
|
||||||
{
|
{
|
||||||
_WriteMaybeQuoted(value->Path());
|
_WriteMaybeQuoted(value->Path());
|
||||||
if (!value->TemplatePath().IsEmpty()) {
|
if (value->IsDirectory()) {
|
||||||
|
_Write(" directory");
|
||||||
|
} else if (!value->TemplatePath().IsEmpty()) {
|
||||||
_Write(" template ");
|
_Write(" template ");
|
||||||
_WriteMaybeQuoted(value->TemplatePath());
|
_WriteMaybeQuoted(value->TemplatePath());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,8 @@ BUserSettingsFileInfo::BUserSettingsFileInfo(
|
|||||||
const BHPKG::BUserSettingsFileInfoData& infoData)
|
const BHPKG::BUserSettingsFileInfoData& infoData)
|
||||||
:
|
:
|
||||||
fPath(infoData.path),
|
fPath(infoData.path),
|
||||||
fTemplatePath(infoData.templatePath)
|
fTemplatePath(infoData.templatePath),
|
||||||
|
fIsDirectory(infoData.isDirectory)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -33,7 +34,18 @@ BUserSettingsFileInfo::BUserSettingsFileInfo(const BString& path,
|
|||||||
const BString& templatePath)
|
const BString& templatePath)
|
||||||
:
|
:
|
||||||
fPath(path),
|
fPath(path),
|
||||||
fTemplatePath(templatePath)
|
fTemplatePath(templatePath),
|
||||||
|
fIsDirectory(false)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BUserSettingsFileInfo::BUserSettingsFileInfo(const BString& path,
|
||||||
|
bool isDirectory)
|
||||||
|
:
|
||||||
|
fPath(path),
|
||||||
|
fTemplatePath(),
|
||||||
|
fIsDirectory(isDirectory)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -64,11 +76,28 @@ BUserSettingsFileInfo::TemplatePath() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
BUserSettingsFileInfo::IsDirectory() const
|
||||||
|
{
|
||||||
|
return fIsDirectory;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BUserSettingsFileInfo::SetTo(const BString& path, const BString& templatePath)
|
BUserSettingsFileInfo::SetTo(const BString& path, const BString& templatePath)
|
||||||
{
|
{
|
||||||
fPath = path;
|
fPath = path;
|
||||||
fTemplatePath = templatePath;
|
fTemplatePath = templatePath;
|
||||||
|
fIsDirectory = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
BUserSettingsFileInfo::SetTo(const BString& path, bool isDirectory)
|
||||||
|
{
|
||||||
|
fPath = path;
|
||||||
|
fTemplatePath.Truncate(0);
|
||||||
|
fIsDirectory = isDirectory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -321,11 +321,11 @@ ReaderImplBase::PackageResolvableExpressionAttributeHandler::HandleAttribute(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark - GlobalSettingsFileInfoAttributeHandler
|
// #pragma mark - GlobalWritableFileInfoAttributeHandler
|
||||||
|
|
||||||
|
|
||||||
ReaderImplBase::GlobalSettingsFileInfoAttributeHandler
|
ReaderImplBase::GlobalWritableFileInfoAttributeHandler
|
||||||
::GlobalSettingsFileInfoAttributeHandler(
|
::GlobalWritableFileInfoAttributeHandler(
|
||||||
BPackageInfoAttributeValue& packageInfoValue)
|
BPackageInfoAttributeValue& packageInfoValue)
|
||||||
:
|
:
|
||||||
PackageInfoAttributeHandlerBase(packageInfoValue)
|
PackageInfoAttributeHandlerBase(packageInfoValue)
|
||||||
@@ -334,21 +334,21 @@ ReaderImplBase::GlobalSettingsFileInfoAttributeHandler
|
|||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
ReaderImplBase::GlobalSettingsFileInfoAttributeHandler::HandleAttribute(
|
ReaderImplBase::GlobalWritableFileInfoAttributeHandler::HandleAttribute(
|
||||||
AttributeHandlerContext* context, uint8 id, const AttributeValue& value,
|
AttributeHandlerContext* context, uint8 id, const AttributeValue& value,
|
||||||
AttributeHandler** _handler)
|
AttributeHandler** _handler)
|
||||||
{
|
{
|
||||||
switch (id) {
|
switch (id) {
|
||||||
case B_HPKG_ATTRIBUTE_ID_PACKAGE_SETTINGS_FILE_UPDATE_TYPE:
|
case B_HPKG_ATTRIBUTE_ID_PACKAGE_WRITABLE_FILE_UPDATE_TYPE:
|
||||||
if (value.unsignedInt >= B_PACKAGE_RESOLVABLE_OP_ENUM_COUNT) {
|
if (value.unsignedInt >= B_WRITABLE_FILE_UPDATE_TYPE_ENUM_COUNT) {
|
||||||
context->errorOutput->PrintError(
|
context->errorOutput->PrintError(
|
||||||
"Error: Invalid package attribute section: invalid "
|
"Error: Invalid package attribute section: invalid "
|
||||||
"global settings file update type %" B_PRIu64
|
"global settings file update type %" B_PRIu64
|
||||||
" encountered\n", value.unsignedInt);
|
" encountered\n", value.unsignedInt);
|
||||||
return B_BAD_DATA;
|
return B_BAD_DATA;
|
||||||
}
|
}
|
||||||
fPackageInfoValue.globalSettingsFileInfo.updateType
|
fPackageInfoValue.globalWritableFileInfo.updateType
|
||||||
= (BSettingsFileUpdateType)value.unsignedInt;
|
= (BWritableFileUpdateType)value.unsignedInt;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -604,15 +604,15 @@ ReaderImplBase::PackageAttributeHandler::HandleAttribute(
|
|||||||
fPackageInfoValue.SetTo(B_PACKAGE_INFO_INSTALL_PATH, value.string);
|
fPackageInfoValue.SetTo(B_PACKAGE_INFO_INSTALL_PATH, value.string);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case B_HPKG_ATTRIBUTE_ID_PACKAGE_GLOBAL_SETTINGS_FILE:
|
case B_HPKG_ATTRIBUTE_ID_PACKAGE_GLOBAL_WRITABLE_FILE:
|
||||||
fPackageInfoValue.globalSettingsFileInfo.path = value.string;
|
fPackageInfoValue.globalWritableFileInfo.path = value.string;
|
||||||
fPackageInfoValue.globalSettingsFileInfo.updateType
|
fPackageInfoValue.globalWritableFileInfo.updateType
|
||||||
= B_SETTINGS_FILE_UPDATE_TYPE_ENUM_COUNT;
|
= B_WRITABLE_FILE_UPDATE_TYPE_ENUM_COUNT;
|
||||||
fPackageInfoValue.attributeID
|
fPackageInfoValue.attributeID
|
||||||
= B_PACKAGE_INFO_GLOBAL_SETTINGS_FILES;
|
= B_PACKAGE_INFO_GLOBAL_WRITABLE_FILES;
|
||||||
if (_handler != NULL) {
|
if (_handler != NULL) {
|
||||||
*_handler
|
*_handler
|
||||||
= new(std::nothrow) GlobalSettingsFileInfoAttributeHandler(
|
= new(std::nothrow) GlobalWritableFileInfoAttributeHandler(
|
||||||
fPackageInfoValue);
|
fPackageInfoValue);
|
||||||
if (*_handler == NULL)
|
if (*_handler == NULL)
|
||||||
return B_NO_MEMORY;
|
return B_NO_MEMORY;
|
||||||
|
|||||||
@@ -379,18 +379,27 @@ WriterImplBase::RegisterPackageInfo(PackageAttributeList& attributeList,
|
|||||||
_AddStringAttributeList(B_HPKG_ATTRIBUTE_ID_PACKAGE_REPLACES,
|
_AddStringAttributeList(B_HPKG_ATTRIBUTE_ID_PACKAGE_REPLACES,
|
||||||
packageInfo.ReplacesList(), attributeList);
|
packageInfo.ReplacesList(), attributeList);
|
||||||
|
|
||||||
// global settings file info list
|
// global writable file info list
|
||||||
const BObjectList<BGlobalSettingsFileInfo>& globalSettingsFileInfos
|
const BObjectList<BGlobalWritableFileInfo>& globalWritableFileInfos
|
||||||
= packageInfo.GlobalSettingsFileInfos();
|
= packageInfo.GlobalWritableFileInfos();
|
||||||
for (int32 i = 0; i < globalSettingsFileInfos.CountItems(); ++i) {
|
for (int32 i = 0; i < globalWritableFileInfos.CountItems(); ++i) {
|
||||||
BGlobalSettingsFileInfo* info = globalSettingsFileInfos.ItemAt(i);
|
BGlobalWritableFileInfo* info = globalWritableFileInfos.ItemAt(i);
|
||||||
PackageAttribute* attribute = _AddStringAttribute(
|
PackageAttribute* attribute = _AddStringAttribute(
|
||||||
B_HPKG_ATTRIBUTE_ID_PACKAGE_GLOBAL_SETTINGS_FILE, info->Path(),
|
B_HPKG_ATTRIBUTE_ID_PACKAGE_GLOBAL_WRITABLE_FILE, info->Path(),
|
||||||
attributeList);
|
attributeList);
|
||||||
|
|
||||||
|
if (info->IsDirectory()) {
|
||||||
|
PackageAttribute* isDirectoryAttribute = new PackageAttribute(
|
||||||
|
B_HPKG_ATTRIBUTE_ID_PACKAGE_IS_WRITABLE_DIRECTORY,
|
||||||
|
B_HPKG_ATTRIBUTE_TYPE_UINT,
|
||||||
|
B_HPKG_ATTRIBUTE_ENCODING_INT_8_BIT);
|
||||||
|
isDirectoryAttribute->unsignedInt = 1;
|
||||||
|
attribute->children.Add(isDirectoryAttribute);
|
||||||
|
}
|
||||||
|
|
||||||
if (info->IsIncluded()) {
|
if (info->IsIncluded()) {
|
||||||
PackageAttribute* updateTypeAttribute = new PackageAttribute(
|
PackageAttribute* updateTypeAttribute = new PackageAttribute(
|
||||||
B_HPKG_ATTRIBUTE_ID_PACKAGE_SETTINGS_FILE_UPDATE_TYPE,
|
B_HPKG_ATTRIBUTE_ID_PACKAGE_WRITABLE_FILE_UPDATE_TYPE,
|
||||||
B_HPKG_ATTRIBUTE_TYPE_UINT,
|
B_HPKG_ATTRIBUTE_TYPE_UINT,
|
||||||
B_HPKG_ATTRIBUTE_ENCODING_INT_8_BIT);
|
B_HPKG_ATTRIBUTE_ENCODING_INT_8_BIT);
|
||||||
updateTypeAttribute->unsignedInt = info->UpdateType();
|
updateTypeAttribute->unsignedInt = info->UpdateType();
|
||||||
@@ -407,9 +416,18 @@ WriterImplBase::RegisterPackageInfo(PackageAttributeList& attributeList,
|
|||||||
B_HPKG_ATTRIBUTE_ID_PACKAGE_USER_SETTINGS_FILE, info->Path(),
|
B_HPKG_ATTRIBUTE_ID_PACKAGE_USER_SETTINGS_FILE, info->Path(),
|
||||||
attributeList);
|
attributeList);
|
||||||
|
|
||||||
_AddStringAttributeIfNotEmpty(
|
if (info->IsDirectory()) {
|
||||||
B_HPKG_ATTRIBUTE_ID_PACKAGE_SETTINGS_FILE_TEMPLATE,
|
PackageAttribute* isDirectoryAttribute = new PackageAttribute(
|
||||||
info->TemplatePath(), attribute->children);
|
B_HPKG_ATTRIBUTE_ID_PACKAGE_IS_WRITABLE_DIRECTORY,
|
||||||
|
B_HPKG_ATTRIBUTE_TYPE_UINT,
|
||||||
|
B_HPKG_ATTRIBUTE_ENCODING_INT_8_BIT);
|
||||||
|
isDirectoryAttribute->unsignedInt = 1;
|
||||||
|
attribute->children.Add(isDirectoryAttribute);
|
||||||
|
} else {
|
||||||
|
_AddStringAttributeIfNotEmpty(
|
||||||
|
B_HPKG_ATTRIBUTE_ID_PACKAGE_SETTINGS_FILE_TEMPLATE,
|
||||||
|
info->TemplatePath(), attribute->children);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// user list
|
// user list
|
||||||
|
|||||||
Reference in New Issue
Block a user