History log of /haiku/src/system/libroot/os/find_paths.cpp
Revision Date Author Comments
# 8079adc0 16-Dec-2022 Jessica Hamilton <jessica.l.hamilton@gmail.com>

libroot: fix path inconsistency in the find path API.

With the package kit merge, settings from packages were
placed into ~/config/settings/global for packages installed
into the PackageFS Home mount.

As a result, B_FIND_PATH_SETTINGS_DIRECTORY was returning a
user settings path different to the find directory API, making
transitioning from find directory to find path incompatible.

This change also updates the package_daemon and packagefs
to remove the remapping also occurring there.

Change-Id: Id5d077503e177a5f7cbc48779c132160b0d01890
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5941
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>


# ab57ee42 04-Dec-2020 X512 <danger_mail@list.ru>

fix build after MethodDeleter interface change

Change-Id: Iadb9e37772fd6588636085944c1455249ac0f926
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3457
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>


# 57db30a7 29-Dec-2016 Murai Takashi <tmurai01@gmail.com>

find_paths.cpp: fix memory leak

Signed-off-by: Adrien Destugues <pulkomandy@pulkomandy.tk>

fixes #13136


# 040029e0 28-Apr-2015 Humdinger <humdingerb@gmail.com>

Have B_FIND_PATH_LIB_DIRECTORY return the architecture.

Fixes #12028.


# b7a87fd1 26-Mar-2015 Axel Dörfler <axeld@pinc-software.de>

find_paths_etc(): added user/system only flags.

* B_FIND_PATHS_(USER|SYSTEM)_ONLY cause only the specified paths
to be included in the result list.


# 09a89192 26-Nov-2013 Rene Gollent <rene@gollent.com>

InstallationLocations: Add missing static specifiers.

- Fixes a crash in find_paths() due to the InstallationLocations object getting overwritten.

Thanks to Chris Roberts for reporting.


# 23c521cf 20-Nov-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

find_path*(): Improve B_FIND_PATH_IMAGE_PATH handling

* get_file_attribute(): Use O_NOTRAVERSE, so we correctly read the
attribute from symlinks.
* internal_path_for_path(): Shuffle things around a bit: The dependency
is resolved before handling B_FIND_PATH_PACKAGE_PATH, now. This adds
support for getting the package file for a dependency. The dependency
was ignored in this case before.
* Use kSystemPackageLinksDirectory instead of hard-coding "/packages".


# 81522ad4 18-Nov-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

find_path_for_path_etc(): Fail for B_FIND_PATH_IMAGE_PATH

There's no image in this case. We would just return the path we were
given.


# 22e92014 18-Nov-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

s/B_FIND_PATH_IMAGE_PACKAGE_PATH/B_FIND_PATH_PACKAGE_PATH/

It doesn't only work for image files, so make the name more general.


# 94fb954c 17-Nov-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

find_path*(): Support user specific home directory

No longer hard-code the home directory path. Instead ask
find_directory(), so we get the correct one for the current user.


# 04c6cb37 17-Nov-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

find_directory(): Add architecture support

* Move PathBuffer helper class out of find_paths.cpp into its own
header.
* find_directory():
- Make use of MemoryDeleter to simplify things.
- Make use of PathBuffer for a simpler and more correct handling.
- Make B_UTILITIES_DIRECTORY to B_APPS_DIRECTORY. /boot/utilities
doesn't exist anyway.
- Resolve the concerned constants to the architecture specific
subdirectory, when called in a secondary architecture context, just
like find_path*().


# 7fb0d6c2 17-Nov-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

find_path*(): Fix B_FIND_PATH_MEDIA_NODES_DIRECTORY

It is architecture specific as well.


# 60b39cd7 16-Nov-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

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.


# 986e4abc 05-Nov-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Add new API find_path[s](), find_path_for_path()

The new functions are meant to replace many uses of find_directory():
* find_paths() is supposed to be used when the directories of a certain
kind in all installation directories are needed (e.g. font
directories, add-on directory, etc.). Using this API makes code
robust wrt addition or removal of installation locations.
* find_path() is supposed to be used when files/directories associated
with a loaded program, library, or add-on need to be found (e.g. data
files or global settings).
* find_path_for_path() is similar to find_path(), but it starts from a
given path instead of an image.


# 040029e0b8d43ea683c12aa721772040f13cf279 28-Apr-2015 Humdinger <humdingerb@gmail.com>

Have B_FIND_PATH_LIB_DIRECTORY return the architecture.

Fixes #12028.


# b7a87fd137abbe3798ef02639468782bf5bab808 26-Mar-2015 Axel Dörfler <axeld@pinc-software.de>

find_paths_etc(): added user/system only flags.

* B_FIND_PATHS_(USER|SYSTEM)_ONLY cause only the specified paths
to be included in the result list.


# 09a891921385287519be8dbd01da602630cfe406 26-Nov-2013 Rene Gollent <rene@gollent.com>

InstallationLocations: Add missing static specifiers.

- Fixes a crash in find_paths() due to the InstallationLocations object getting overwritten.

Thanks to Chris Roberts for reporting.


# 23c521cf5ec92d7a6a4a85149fc520398b0b9930 20-Nov-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

find_path*(): Improve B_FIND_PATH_IMAGE_PATH handling

* get_file_attribute(): Use O_NOTRAVERSE, so we correctly read the
attribute from symlinks.
* internal_path_for_path(): Shuffle things around a bit: The dependency
is resolved before handling B_FIND_PATH_PACKAGE_PATH, now. This adds
support for getting the package file for a dependency. The dependency
was ignored in this case before.
* Use kSystemPackageLinksDirectory instead of hard-coding "/packages".


# 81522ad41bd88b1202fab14446ba2ba33d750fd1 18-Nov-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

find_path_for_path_etc(): Fail for B_FIND_PATH_IMAGE_PATH

There's no image in this case. We would just return the path we were
given.


# 22e92014f0dd38c0b621a94af3453a9e15b95609 18-Nov-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

s/B_FIND_PATH_IMAGE_PACKAGE_PATH/B_FIND_PATH_PACKAGE_PATH/

It doesn't only work for image files, so make the name more general.


# 94fb954c53b88e1c2c39648b35e1db08679cca0b 17-Nov-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

find_path*(): Support user specific home directory

No longer hard-code the home directory path. Instead ask
find_directory(), so we get the correct one for the current user.


# 04c6cb37bb8e0115f90974e99d6d823857c6836e 17-Nov-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

find_directory(): Add architecture support

* Move PathBuffer helper class out of find_paths.cpp into its own
header.
* find_directory():
- Make use of MemoryDeleter to simplify things.
- Make use of PathBuffer for a simpler and more correct handling.
- Make B_UTILITIES_DIRECTORY to B_APPS_DIRECTORY. /boot/utilities
doesn't exist anyway.
- Resolve the concerned constants to the architecture specific
subdirectory, when called in a secondary architecture context, just
like find_path*().


# 7fb0d6c269dea0f977a249af6e7c8991d1ae743f 17-Nov-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

find_path*(): Fix B_FIND_PATH_MEDIA_NODES_DIRECTORY

It is architecture specific as well.


# 60b39cd7416028e61e3d30bb3ba28bd3526e6001 16-Nov-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

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.


# 986e4abce4efeccd9418eb8cdc7a710487f093b9 05-Nov-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Add new API find_path[s](), find_path_for_path()

The new functions are meant to replace many uses of find_directory():
* find_paths() is supposed to be used when the directories of a certain
kind in all installation directories are needed (e.g. font
directories, add-on directory, etc.). Using this API makes code
robust wrt addition or removal of installation locations.
* find_path() is supposed to be used when files/directories associated
with a loaded program, library, or add-on need to be found (e.g. data
files or global settings).
* find_path_for_path() is similar to find_path(), but it starts from a
given path instead of an image.