HaikuDepot: Some work in progress to prepare "opening" packages
The idea is to parse packages for Deskbar links and offer to "open" them once they are installed. The added functionality is not yet complete and will eventually figure out the file system location of a package and parse the contents. I am mainly pushing this since my git-foo is limited and I want to push the fix for the discovered deadlock.
This commit is contained in:
@@ -8,7 +8,10 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <FindDirectory.h>
|
||||
#include <package/PackageDefs.h>
|
||||
#include <package/PackageFlags.h>
|
||||
#include <Path.h>
|
||||
|
||||
|
||||
|
||||
@@ -727,6 +730,43 @@ PackageInfo::SetLocalFilePath(const char* path)
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
PackageInfo::IsLocalFile() const
|
||||
{
|
||||
return !fLocalFilePath.IsEmpty() && fInstallationLocations.empty();
|
||||
}
|
||||
|
||||
|
||||
BPath
|
||||
PackageInfo::FindAppToLaunch() const
|
||||
{
|
||||
BPath path;
|
||||
if (fLocalFilePath.IsEmpty() || fInstallationLocations.empty())
|
||||
return path;
|
||||
|
||||
BPath packagePath;
|
||||
if (fInstallationLocations.find(
|
||||
BPackageKit::B_PACKAGE_INSTALLATION_LOCATION_SYSTEM)
|
||||
!= fInstallationLocations.end()) {
|
||||
if (find_directory(B_SYSTEM_PACKAGES_DIRECTORY, &packagePath) != B_OK)
|
||||
return path;
|
||||
} else if (fInstallationLocations.find(
|
||||
BPackageKit::B_PACKAGE_INSTALLATION_LOCATION_HOME)
|
||||
!= fInstallationLocations.end()) {
|
||||
if (find_directory(B_USER_PACKAGES_DIRECTORY, &packagePath) != B_OK)
|
||||
return path;
|
||||
} else {
|
||||
return path;
|
||||
}
|
||||
|
||||
packagePath.Append(fLocalFilePath);
|
||||
|
||||
// TODO: Scan package contents for Deskbar links
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
PackageInfo::ClearUserRatings()
|
||||
{
|
||||
|
||||
@@ -16,6 +16,9 @@
|
||||
#include "SharedBitmap.h"
|
||||
|
||||
|
||||
class BPath;
|
||||
|
||||
|
||||
class UserInfo {
|
||||
public:
|
||||
UserInfo();
|
||||
@@ -298,8 +301,9 @@ public:
|
||||
void SetLocalFilePath(const char* path);
|
||||
const BString& LocalFilePath() const
|
||||
{ return fLocalFilePath; }
|
||||
bool IsLocalFile() const
|
||||
{ return !fLocalFilePath.IsEmpty(); }
|
||||
bool IsLocalFile() const;
|
||||
|
||||
BPath FindAppToLaunch() const;
|
||||
|
||||
void ClearCategories();
|
||||
bool AddCategory(const CategoryRef& category);
|
||||
|
||||
Reference in New Issue
Block a user