Skip to content

Commit

Permalink
#1449 output useless .plist file to silence AppleScript warning
Browse files Browse the repository at this point in the history
  • Loading branch information
koekeishiya committed Sep 25, 2022
1 parent 722d213 commit 719af3b
Showing 1 changed file with 36 additions and 1 deletion.
37 changes: 36 additions & 1 deletion src/sa.m
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,43 @@
static char osax_contents_dir[MAXLEN];
static char osax_contents_macos_dir[MAXLEN];
static char osax_contents_res_dir[MAXLEN];
static char osax_info_plist[MAXLEN];
static char osax_payload_dir[MAXLEN];
static char osax_payload_contents_dir[MAXLEN];
static char osax_payload_contents_macos_dir[MAXLEN];
static char osax_payload_plist[MAXLEN];
static char osax_bin_payload[MAXLEN];
static char osax_bin_loader[MAXLEN];

static char sa_plist[] =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
"<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n"
"<plist version=\"1.0\">\n"
"<dict>\n"
"<key>CFBundleDevelopmentRegion</key>\n"
"<string>en</string>\n"
"<key>CFBundleExecutable</key>\n"
"<string>loader</string>\n"
"<key>CFBundleIdentifier</key>\n"
"<string>com.koekeishiya.yabai-osax</string>\n"
"<key>CFBundleInfoDictionaryVersion</key>\n"
"<string>6.0</string>\n"
"<key>CFBundleName</key>\n"
"<string>yabai</string>\n"
"<key>CFBundlePackageType</key>\n"
"<string>osax</string>\n"
"<key>CFBundleShortVersionString</key>\n"
"<string>"OSAX_VERSION"</string>\n"
"<key>CFBundleVersion</key>\n"
"<string>"OSAX_VERSION"</string>\n"
"<key>NSHumanReadableCopyright</key>\n"
"<string>Copyright © 2019 Åsmund Vikane. All rights reserved.</string>\n"
"<key>OSAXHandlers</key>\n"
"<dict>\n"
"</dict>\n"
"</dict>\n"
"</plist>";

static char sa_bundle_plist[] =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
"<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n"
Expand Down Expand Up @@ -53,12 +83,13 @@ static void scripting_addition_set_path(void)
snprintf(osax_contents_dir, sizeof(osax_contents_dir), "%s/%s", osax_base_dir, "Contents");
snprintf(osax_contents_macos_dir, sizeof(osax_contents_macos_dir), "%s/%s", osax_contents_dir, "MacOS");
snprintf(osax_contents_res_dir, sizeof(osax_contents_res_dir), "%s/%s", osax_contents_dir, "Resources");
snprintf(osax_info_plist, sizeof(osax_info_plist), "%s/%s", osax_contents_dir, "Info.plist");

snprintf(osax_payload_dir, sizeof(osax_payload_dir), "%s/%s", osax_contents_res_dir, "payload.bundle");
snprintf(osax_payload_contents_dir, sizeof(osax_payload_contents_dir), "%s/%s", osax_payload_dir, "Contents");
snprintf(osax_payload_contents_macos_dir, sizeof(osax_payload_contents_macos_dir), "%s/%s", osax_payload_contents_dir, "MacOS");

snprintf(osax_payload_plist, sizeof(osax_payload_plist), "%s/%s", osax_payload_contents_dir, "Info.plist");

snprintf(osax_bin_loader, sizeof(osax_bin_loader), "%s/%s", osax_contents_macos_dir, "loader");
snprintf(osax_bin_payload, sizeof(osax_bin_payload), "%s/%s", osax_payload_contents_macos_dir, "payload");
}
Expand Down Expand Up @@ -183,6 +214,10 @@ static int scripting_addition_install(void)
goto cleanup;
}

if (!scripting_addition_write_file(sa_plist, strlen(sa_plist), osax_info_plist, "w")) {
goto cleanup;
}

if (!scripting_addition_write_file(sa_bundle_plist, strlen(sa_bundle_plist), osax_payload_plist, "w")) {
goto cleanup;
}
Expand Down

0 comments on commit 719af3b

Please sign in to comment.