Accepts URLs as command line arguments.
Fixes #9793 Signed-off-by: Kacper Kasper <[email protected]>
This commit is contained in:
@@ -229,9 +229,19 @@ MainApp::ArgvReceived(int32 argc, char** argv)
|
|||||||
char cwd[B_PATH_NAME_LENGTH];
|
char cwd[B_PATH_NAME_LENGTH];
|
||||||
getcwd(cwd, sizeof(cwd));
|
getcwd(cwd, sizeof(cwd));
|
||||||
|
|
||||||
BMessage message(B_REFS_RECEIVED);
|
|
||||||
|
|
||||||
for (int i = 1; i < argc; i++) {
|
for (int i = 1; i < argc; i++) {
|
||||||
|
BUrl url(argv[i]);
|
||||||
|
if (url.IsValid()) {
|
||||||
|
BMessage archivedUrl;
|
||||||
|
url.Archive(&archivedUrl);
|
||||||
|
|
||||||
|
BMessage msg(M_URL_RECEIVED);
|
||||||
|
if (msg.AddMessage("mediaplayer:url", &archivedUrl) == B_OK)
|
||||||
|
RefsReceived(&msg);
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
BPath path;
|
BPath path;
|
||||||
if (argv[i][0] != '/')
|
if (argv[i][0] != '/')
|
||||||
path.SetTo(cwd, argv[i]);
|
path.SetTo(cwd, argv[i]);
|
||||||
@@ -241,13 +251,11 @@ MainApp::ArgvReceived(int32 argc, char** argv)
|
|||||||
if (!entry.Exists() || !entry.IsFile())
|
if (!entry.Exists() || !entry.IsFile())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
BMessage message(B_REFS_RECEIVED);
|
||||||
entry_ref ref;
|
entry_ref ref;
|
||||||
if (entry.GetRef(&ref) == B_OK)
|
if (entry.GetRef(&ref) == B_OK && message.AddRef("refs", &ref) == B_OK)
|
||||||
message.AddRef("refs", &ref);
|
RefsReceived(&message);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (message.HasRef("refs"))
|
|
||||||
RefsReceived(&message);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user