Make mountvolume a BApplication and set it as the preferred one for opening BFS and (for now) ISO images.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32275 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
84e0703c87
commit
d0cab16b9f
@ -14,6 +14,7 @@ ResComp $(haiku-utils_rsrc) : [ FGristFiles haiku-utils.rdef ] ;
|
||||
AddResources fortune : fortune.rdef ;
|
||||
AddResources hey : hey.rdef ;
|
||||
AddResources mimeset : mimeset.rdef ;
|
||||
AddResources mountvolume : mountvolume.rdef ;
|
||||
AddResources urlwrapper : urlwrapper.rdef ;
|
||||
|
||||
# standard commands that don't need any additional library
|
||||
|
@ -1,8 +1,9 @@
|
||||
/*
|
||||
* Copyright 2005-2007, Ingo Weinhold, bonefish@users.sf.net. All rights reserved.
|
||||
* Copyright 2005-2009, Axel Dörfler, axeld@pinc-software.de.
|
||||
* Copyright 2005-2007 Ingo Weinhold, bonefish@users.sf.net
|
||||
* Copyright 2005-2009 Axel Dörfler, axeld@pinc-software.de
|
||||
* Copyright 2009 Jonas Sundström, jonas@kirilla.se
|
||||
*
|
||||
* Distributed under the terms of the MIT License.
|
||||
* All rights reserved. Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
|
||||
@ -14,6 +15,7 @@
|
||||
#include <string.h>
|
||||
#include <termios.h>
|
||||
|
||||
#include <Application.h>
|
||||
#include <Path.h>
|
||||
#include <String.h>
|
||||
#include <fs_volume.h>
|
||||
@ -288,8 +290,67 @@ struct PrintPartitionsVisitor : public BDiskDeviceVisitor {
|
||||
// #pragma mark -
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char** argv)
|
||||
class MountVolume : public BApplication {
|
||||
public:
|
||||
MountVolume();
|
||||
virtual ~MountVolume();
|
||||
|
||||
virtual void RefsReceived(BMessage* message);
|
||||
virtual void ArgvReceived(int32 argc, char** argv);
|
||||
virtual void ReadyToRun();
|
||||
};
|
||||
|
||||
|
||||
MountVolume::MountVolume()
|
||||
:
|
||||
BApplication("application/x-vnd.haiku-mountvolume")
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
MountVolume::~MountVolume()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
MountVolume::RefsReceived(BMessage* message)
|
||||
{
|
||||
status_t status;
|
||||
int32 refCount;
|
||||
type_code typeFound;
|
||||
|
||||
status = message->GetInfo("refs", &typeFound, &refCount);
|
||||
if (status != B_OK || refCount < 1) {
|
||||
fprintf(stderr, "Failed to get info from entry_refs BMessage: %s\n",
|
||||
strerror(status));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
entry_ref ref;
|
||||
BPath path;
|
||||
|
||||
int32 argc = refCount + 1;
|
||||
char** argv = new char*[argc + 1];
|
||||
argv[0] = strdup(kAppName);
|
||||
|
||||
for (int32 i = 0; i < refCount; i++) {
|
||||
message->FindRef("refs", i, &ref);
|
||||
status = path.SetTo(&ref);
|
||||
if (status != B_OK) {
|
||||
fprintf(stderr, "Failed to get a path (%s) from entry (%s): %s\n",
|
||||
path.Path(), ref.name, strerror(status));
|
||||
}
|
||||
argv[1 + i] = strdup(path.Path());
|
||||
}
|
||||
argv[argc] = NULL;
|
||||
|
||||
ArgvReceived(argc, argv);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
MountVolume::ArgvReceived(int32 argc, char** argv)
|
||||
{
|
||||
MountVisitor mountVisitor;
|
||||
PrintPartitionsVisitor printPartitionsVisitor;
|
||||
@ -460,5 +521,25 @@ main(int argc, char** argv)
|
||||
deviceList.VisitEachMountablePartition(&printPartitionsVisitor);
|
||||
}
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
MountVolume::ReadyToRun()
|
||||
{
|
||||
Quit();
|
||||
}
|
||||
|
||||
|
||||
// #pragma mark -
|
||||
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
MountVolume mountVolume;
|
||||
mountVolume.Run();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
10
src/bin/mountvolume.rdef
Normal file
10
src/bin/mountvolume.rdef
Normal file
@ -0,0 +1,10 @@
|
||||
resource app_signature "application/x-vnd.haiku-mountvolume";
|
||||
|
||||
resource app_flags B_MULTIPLE_LAUNCH | B_BACKGROUND_APP;
|
||||
|
||||
resource(1, "BEOS:FILE_TYPES") message
|
||||
{
|
||||
"types" = "application/x-bfs-image",
|
||||
"types" = "application/x-cd-image"
|
||||
};
|
||||
|
@ -14,7 +14,9 @@ resource(5, "META:EXTENS") message(234) {
|
||||
"type" = "application/x-bfs-image"
|
||||
};
|
||||
|
||||
resource(6, "META:ICON") #'VICN' array {
|
||||
resource(6, "META:PREF_APP") #'MSIG' "application/x-vnd.haiku-mountvolume";
|
||||
|
||||
resource(7, "META:ICON") #'VICN' array {
|
||||
$"6E636966080500040054020006023B019B3AA235BC243E3C71D248D17C498491"
|
||||
$"00E7BB8FFFC99867020006023BA71138D0C8BBF4B83E90E64AED7C485BD7008A"
|
||||
$"561DFFB57A3A02000602BB6FCBB8D4C839AA71BC3992492FF148D96A00FFC790"
|
||||
|
@ -11,7 +11,9 @@ resource(3, "META:EXTENS") message(234) {
|
||||
"type" = "application/x-cd-image"
|
||||
};
|
||||
|
||||
resource(4, "META:ICON") #'VICN' array {
|
||||
resource(4, "META:PREF_APP") #'MSIG' "application/x-vnd.haiku-mountvolume";
|
||||
|
||||
resource(5, "META:ICON") #'VICN' array {
|
||||
$"6E63696605050002030605B812A5BE03E13DE784B8021049F79F4A16EC00F1F1"
|
||||
$"F136D9DDF48A9996B9B4B8BEDBFFF4F4F404EBD0020006023C92C0388F5FB854"
|
||||
$"503C576348D8DF48C95B004137A9FFB9B9B904017E0402043F2E4E2E302E2242"
|
||||
|
Loading…
x
Reference in New Issue
Block a user