Added find_test_app() functions that return the path/an entry_ref for a given test app.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@658 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
614fabb05b
commit
c2e8b5572c
@ -4,6 +4,7 @@
|
||||
#include <unistd.h>
|
||||
|
||||
#include <Autolock.h>
|
||||
#include <Entry.h>
|
||||
#include <Messenger.h>
|
||||
#include <String.h>
|
||||
|
||||
@ -46,13 +47,7 @@ AppRunner::Run(const char *command, const char *args, bool findCommand)
|
||||
// get the app path
|
||||
BString appPath;
|
||||
if (findCommand) {
|
||||
appPath = BTestShell::GlobalTestDir();
|
||||
appPath.CharacterEscape(" \t\n!\"'`$&()?*+{}[]<>|", '\\');
|
||||
appPath += "/kits/app/";
|
||||
appPath += command;
|
||||
#ifdef TEST_R5
|
||||
appPath += "_r5";
|
||||
#endif
|
||||
find_test_app(command, &appPath);
|
||||
command = appPath.String();
|
||||
}
|
||||
// add args, i.e. compose the command line
|
||||
@ -253,3 +248,34 @@ port_id AppRunner::fTeamPort = -1;
|
||||
// fTeamPortLock
|
||||
BLocker AppRunner::fTeamPortLock;
|
||||
|
||||
|
||||
// find_test_app
|
||||
status_t
|
||||
find_test_app(const char *testApp, BString *path)
|
||||
{
|
||||
status_t error = (testApp && path ? B_OK : B_BAD_VALUE);
|
||||
if (error == B_OK) {
|
||||
*path = BTestShell::GlobalTestDir();
|
||||
path->CharacterEscape(" \t\n!\"'`$&()?*+{}[]<>|", '\\');
|
||||
*path += "/kits/app/";
|
||||
*path += testApp;
|
||||
#ifdef TEST_R5
|
||||
*path += "_r5";
|
||||
#endif
|
||||
}
|
||||
return error;
|
||||
}
|
||||
|
||||
// find_test_app
|
||||
status_t
|
||||
find_test_app(const char *testApp, entry_ref *ref)
|
||||
{
|
||||
status_t error = (testApp && ref ? B_OK : B_BAD_VALUE);
|
||||
BString path;
|
||||
if (error == B_OK)
|
||||
error = find_test_app(testApp, &path);
|
||||
if (error == B_OK)
|
||||
error = get_ref_for_path(path.String(), ref);
|
||||
return error;
|
||||
}
|
||||
|
||||
|
@ -45,4 +45,7 @@ private:
|
||||
static BLocker fTeamPortLock;
|
||||
};
|
||||
|
||||
status_t find_test_app(const char *testApp, BString *path);
|
||||
status_t find_test_app(const char *testApp, entry_ref *ref);
|
||||
|
||||
#endif // APP_RUNNER_H
|
||||
|
Loading…
x
Reference in New Issue
Block a user