Add get_*architecture() API, extend find_path*() API
* Add get_architecture(), get_primary_architecture(), get_secondary_architectures(), guess_architecture_for_path() to get the caller's architecture, the primary architecture, all secondary architectures, or the architecture associated with a specified path respectively. * Rename the find_path*() functions to find_path*_etc() and add an optional architecture parameter. Add simplified find_path*() functions. * BPathFinder: Add FindPath[s]() versions with an architecture parameter.
This commit is contained in:
@@ -170,16 +170,26 @@ extern "C" {
|
||||
status_t find_directory(directory_which which, dev_t volume, bool createIt,
|
||||
char* pathString, int32 length);
|
||||
|
||||
status_t find_path(const void* codePointer, const char* dependency,
|
||||
path_base_directory baseDirectory, const char* subPath, uint32 flags,
|
||||
char* pathBuffer, size_t bufferSize);
|
||||
status_t find_path(const void* codePointer, path_base_directory baseDirectory,
|
||||
const char* subPath, char* pathBuffer, size_t bufferSize);
|
||||
|
||||
status_t find_path_for_path(const char* path, const char* dependency,
|
||||
path_base_directory baseDirectory, const char* subPath, uint32 flags,
|
||||
char* pathBuffer, size_t bufferSize);
|
||||
status_t find_path_etc(const void* codePointer, const char* dependency,
|
||||
const char* architecture, path_base_directory baseDirectory,
|
||||
const char* subPath, uint32 flags, char* pathBuffer, size_t bufferSize);
|
||||
|
||||
status_t find_path_for_path(const char* path, path_base_directory baseDirectory,
|
||||
const char* subPath, char* pathBuffer, size_t bufferSize);
|
||||
|
||||
status_t find_path_for_path_etc(const char* path, const char* dependency,
|
||||
const char* architecture, path_base_directory baseDirectory,
|
||||
const char* subPath, uint32 flags, char* pathBuffer, size_t bufferSize);
|
||||
|
||||
status_t find_paths(path_base_directory baseDirectory, const char* subPath,
|
||||
uint32 flags, char*** _paths, size_t* _pathCount);
|
||||
char*** _paths, size_t* _pathCount);
|
||||
|
||||
status_t find_paths_etc(const char* architecture,
|
||||
path_base_directory baseDirectory, const char* subPath, uint32 flags,
|
||||
char*** _paths, size_t* _pathCount);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -31,6 +31,10 @@ public:
|
||||
status_t SetTo(const entry_ref& ref,
|
||||
const char* dependency = NULL);
|
||||
|
||||
status_t FindPath(const char* architecture,
|
||||
path_base_directory baseDirectory,
|
||||
const char* subPath, uint32 flags,
|
||||
BPath& path);
|
||||
status_t FindPath(path_base_directory baseDirectory,
|
||||
const char* subPath, uint32 flags,
|
||||
BPath& path);
|
||||
@@ -39,6 +43,10 @@ public:
|
||||
status_t FindPath(path_base_directory baseDirectory,
|
||||
BPath& path);
|
||||
|
||||
static status_t FindPaths(const char* architecture,
|
||||
path_base_directory baseDirectory,
|
||||
const char* subPath, uint32 flags,
|
||||
BStringList& paths);
|
||||
static status_t FindPaths(path_base_directory baseDirectory,
|
||||
const char* subPath, uint32 flags,
|
||||
BStringList& paths);
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright 2013, Haiku, Inc. All Rights Reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef _SUPPORT_ARCHITECTURE_H
|
||||
#define _SUPPORT_ARCHITECTURE_H
|
||||
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
|
||||
const char* get_architecture();
|
||||
const char* get_primary_architecture();
|
||||
size_t get_secondary_architectures(const char** architectures,
|
||||
size_t count);
|
||||
const char* guess_architecture_for_path(const char* path);
|
||||
|
||||
|
||||
__END_DECLS
|
||||
|
||||
|
||||
#endif /* _SUPPORT_ARCHITECTURE_H */
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright 2013, Ingo Weinhold, [email protected].
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef _SYSTEM_ARCHITECTURE_PRIVATE_H
|
||||
#define _SYSTEM_ARCHITECTURE_PRIVATE_H
|
||||
|
||||
|
||||
#include <Architecture.h>
|
||||
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
|
||||
const char* __get_architecture();
|
||||
const char* __get_primary_architecture();
|
||||
size_t __get_secondary_architectures(const char** architectures,
|
||||
size_t count);
|
||||
const char* __guess_architecture_for_path(const char* path);
|
||||
|
||||
|
||||
__END_DECLS
|
||||
|
||||
|
||||
#endif /* _SYSTEM_ARCHITECTURE_PRIVATE_H */
|
||||
@@ -17,16 +17,31 @@ __BEGIN_DECLS
|
||||
status_t __find_directory(directory_which which, dev_t device, bool createIt,
|
||||
char *returnedPath, int32 pathLength);
|
||||
|
||||
status_t __find_path(const void* codePointer, const char* dependency,
|
||||
path_base_directory baseDirectory, const char* subPath, uint32 flags,
|
||||
char* pathBuffer, size_t bufferSize);
|
||||
status_t __find_path(const void* codePointer, path_base_directory baseDirectory,
|
||||
const char* subPath, char* pathBuffer, size_t bufferSize);
|
||||
|
||||
status_t __find_path_for_path(const char* path, const char* dependency,
|
||||
path_base_directory baseDirectory, const char* subPath, uint32 flags,
|
||||
char* pathBuffer, size_t bufferSize);
|
||||
status_t __find_path_etc(const void* codePointer, const char* dependency,
|
||||
const char* architecture, path_base_directory baseDirectory,
|
||||
const char* subPath, uint32 flags, char* pathBuffer, size_t bufferSize);
|
||||
|
||||
status_t __find_path_for_path(const char* path,
|
||||
path_base_directory baseDirectory, const char* subPath, char* pathBuffer,
|
||||
size_t bufferSize);
|
||||
|
||||
status_t __find_path_for_path_etc(const char* path, const char* dependency,
|
||||
const char* architecture, path_base_directory baseDirectory,
|
||||
const char* subPath, uint32 flags, char* pathBuffer, size_t bufferSize);
|
||||
|
||||
status_t __find_paths(path_base_directory baseDirectory, const char* subPath,
|
||||
uint32 flags, char*** _paths, size_t* _pathCount);
|
||||
char*** _paths, size_t* _pathCount);
|
||||
|
||||
status_t __find_paths_etc(const char* architecture,
|
||||
path_base_directory baseDirectory, const char* subPath, uint32 flags,
|
||||
char*** _paths, size_t* _pathCount);
|
||||
|
||||
const char* __guess_secondary_architecture_from_path(const char* path,
|
||||
const char* const* secondaryArchitectures,
|
||||
size_t secondaryArchitectureCount);
|
||||
|
||||
|
||||
__END_DECLS
|
||||
|
||||
Reference in New Issue
Block a user