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:
@@ -14,6 +14,7 @@ ResComp $(haiku-utils_rsrc) : [ FGristFiles haiku-utils.rdef ] ;
|
|||||||
AddResources fortune : fortune.rdef ;
|
AddResources fortune : fortune.rdef ;
|
||||||
AddResources hey : hey.rdef ;
|
AddResources hey : hey.rdef ;
|
||||||
AddResources mimeset : mimeset.rdef ;
|
AddResources mimeset : mimeset.rdef ;
|
||||||
|
AddResources mountvolume : mountvolume.rdef ;
|
||||||
AddResources urlwrapper : urlwrapper.rdef ;
|
AddResources urlwrapper : urlwrapper.rdef ;
|
||||||
|
|
||||||
# standard commands that don't need any additional library
|
# standard commands that don't need any additional library
|
||||||
|
|||||||
+86
-5
@@ -1,8 +1,9 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2005-2007, Ingo Weinhold, [email protected]. All rights reserved.
|
* Copyright 2005-2007 Ingo Weinhold, [email protected]
|
||||||
* Copyright 2005-2009, Axel Dörfler, [email protected].
|
* Copyright 2005-2009 Axel Dörfler, [email protected]
|
||||||
|
* Copyright 2009 Jonas Sundström, [email protected]
|
||||||
*
|
*
|
||||||
* 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 <string.h>
|
||||||
#include <termios.h>
|
#include <termios.h>
|
||||||
|
|
||||||
|
#include <Application.h>
|
||||||
#include <Path.h>
|
#include <Path.h>
|
||||||
#include <String.h>
|
#include <String.h>
|
||||||
#include <fs_volume.h>
|
#include <fs_volume.h>
|
||||||
@@ -288,8 +290,67 @@ struct PrintPartitionsVisitor : public BDiskDeviceVisitor {
|
|||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
int
|
class MountVolume : public BApplication {
|
||||||
main(int argc, char** argv)
|
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;
|
MountVisitor mountVisitor;
|
||||||
PrintPartitionsVisitor printPartitionsVisitor;
|
PrintPartitionsVisitor printPartitionsVisitor;
|
||||||
@@ -460,5 +521,25 @@ main(int argc, char** argv)
|
|||||||
deviceList.VisitEachMountablePartition(&printPartitionsVisitor);
|
deviceList.VisitEachMountablePartition(&printPartitionsVisitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
MountVolume::ReadyToRun()
|
||||||
|
{
|
||||||
|
Quit();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
main()
|
||||||
|
{
|
||||||
|
MountVolume mountVolume;
|
||||||
|
mountVolume.Run();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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"
|
"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"
|
$"6E636966080500040054020006023B019B3AA235BC243E3C71D248D17C498491"
|
||||||
$"00E7BB8FFFC99867020006023BA71138D0C8BBF4B83E90E64AED7C485BD7008A"
|
$"00E7BB8FFFC99867020006023BA71138D0C8BBF4B83E90E64AED7C485BD7008A"
|
||||||
$"561DFFB57A3A02000602BB6FCBB8D4C839AA71BC3992492FF148D96A00FFC790"
|
$"561DFFB57A3A02000602BB6FCBB8D4C839AA71BC3992492FF148D96A00FFC790"
|
||||||
|
|||||||
@@ -11,7 +11,9 @@ resource(3, "META:EXTENS") message(234) {
|
|||||||
"type" = "application/x-cd-image"
|
"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"
|
$"6E63696605050002030605B812A5BE03E13DE784B8021049F79F4A16EC00F1F1"
|
||||||
$"F136D9DDF48A9996B9B4B8BEDBFFF4F4F404EBD0020006023C92C0388F5FB854"
|
$"F136D9DDF48A9996B9B4B8BEDBFFF4F4F404EBD0020006023C92C0388F5FB854"
|
||||||
$"503C576348D8DF48C95B004137A9FFB9B9B904017E0402043F2E4E2E302E2242"
|
$"503C576348D8DF48C95B004137A9FFB9B9B904017E0402043F2E4E2E302E2242"
|
||||||
|
|||||||
Reference in New Issue
Block a user