From 2b1296e8c4d823e80cab8d9db2a5a8f0db2854b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Sun, 8 Nov 2009 13:57:04 +0000 Subject: [PATCH] * Expander now searches its rules file in the data directory, no longer in /etc. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33949 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/expander/ExpanderRules.cpp | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/apps/expander/ExpanderRules.cpp b/src/apps/expander/ExpanderRules.cpp index f8dc93d9ff..5f0cfab58b 100644 --- a/src/apps/expander/ExpanderRules.cpp +++ b/src/apps/expander/ExpanderRules.cpp @@ -102,20 +102,22 @@ ExpanderRules::~ExpanderRules() status_t ExpanderRules::Open(BFile *file) { - BPath path; - if (find_directory(B_USER_CONFIG_DIRECTORY, &path) != B_OK) - return B_ERROR; + directory_which which[] = { + B_USER_DATA_DIRECTORY, + B_COMMON_DATA_DIRECTORY + }; - path.Append("etc/expander.rules"); - if (file->SetTo(path.Path(), B_READ_ONLY) == B_OK) - return B_OK; + for (size_t i = 0; i < sizeof(which) / sizeof(which[0]); i++) { + BPath path; + if (find_directory(which[i], &path) != B_OK) + continue; - if (find_directory(B_COMMON_ETC_DIRECTORY, &path) != B_OK) - return B_ERROR; + path.Append("expander.rules"); + if (file->SetTo(path.Path(), B_READ_ONLY) == B_OK) + return B_OK; + } - path.Append("expander.rules"); - - return file->SetTo(path.Path(), B_READ_ONLY); + return B_ENTRY_NOT_FOUND; }