From 384b968a15f67265a77e7d4541c3c7583ab7aa06 Mon Sep 17 00:00:00 2001 From: Kelvin Sherlock Date: Sat, 9 Feb 2013 20:06:58 -0500 Subject: [PATCH] basename the app name --- bin/loader.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/bin/loader.cpp b/bin/loader.cpp index e6dbc65..781681c 100644 --- a/bin/loader.cpp +++ b/bin/loader.cpp @@ -6,6 +6,7 @@ #include #include #include +#include #include @@ -239,13 +240,13 @@ void InitializeMPW(int argc, char **argv) // 0x0910 CurApName { - - // todo -- basename it. + // basename it. + char * name = basename(argv[0]); char str32[32]; - int l = strlen(argv[0]); + int l = strlen(name); l = std::min(l, 32); str32[0] = l; - memcpy(str32 + 1, argv[0], l); + memcpy(str32 + 1, name, l); while (l < 32) str32[l++] = 0; memcpy(Memory + 0x910, str32, 32);