mirror of
https://github.com/qemu/qemu.git
synced 2025-08-09 10:25:06 +00:00
ui/cocoa: Do not rely on the first argument
The first argument of the executable was used to get its path, but it is not reliable because the executer can specify any arbitrary string. Use the interfaces provided by QEMU and the platform to get those paths. Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com> Message-Id: <20210309122226.23117-2-akihiko.odaki@gmail.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
This commit is contained in:
parent
e31746ecf8
commit
a0f973f931
29
ui/cocoa.m
29
ui/cocoa.m
@ -1398,20 +1398,21 @@ - (void)make_about_window
|
|||||||
[superView addSubview: picture_view];
|
[superView addSubview: picture_view];
|
||||||
|
|
||||||
/* Make the name label */
|
/* Make the name label */
|
||||||
x = 0;
|
NSBundle *bundle = [NSBundle mainBundle];
|
||||||
y = y - 25;
|
if (bundle) {
|
||||||
int name_width = about_width, name_height = 20;
|
x = 0;
|
||||||
NSRect name_rect = NSMakeRect(x, y, name_width, name_height);
|
y = y - 25;
|
||||||
NSTextField *name_label = [[NSTextField alloc] initWithFrame: name_rect];
|
int name_width = about_width, name_height = 20;
|
||||||
[name_label setEditable: NO];
|
NSRect name_rect = NSMakeRect(x, y, name_width, name_height);
|
||||||
[name_label setBezeled: NO];
|
NSTextField *name_label = [[NSTextField alloc] initWithFrame: name_rect];
|
||||||
[name_label setDrawsBackground: NO];
|
[name_label setEditable: NO];
|
||||||
[name_label setAlignment: NSTextAlignmentCenter];
|
[name_label setBezeled: NO];
|
||||||
NSString *qemu_name = [[NSString alloc] initWithCString: gArgv[0]
|
[name_label setDrawsBackground: NO];
|
||||||
encoding: NSASCIIStringEncoding];
|
[name_label setAlignment: NSTextAlignmentCenter];
|
||||||
qemu_name = [qemu_name lastPathComponent];
|
NSString *qemu_name = [[bundle executablePath] lastPathComponent];
|
||||||
[name_label setStringValue: qemu_name];
|
[name_label setStringValue: qemu_name];
|
||||||
[superView addSubview: name_label];
|
[superView addSubview: name_label];
|
||||||
|
}
|
||||||
|
|
||||||
/* Set the version label's attributes */
|
/* Set the version label's attributes */
|
||||||
x = 0;
|
x = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user