Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detect debug mode in platform code of desktop #2393

Merged
merged 3 commits into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions app/linux/main.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
#include "my_application.h"

int main(int argc, char** argv) {
#ifndef NDEBUG
printf("This app works in debug mode\n");
#else
printf("This app works in release mode\n");
#endif

g_autoptr(MyApplication) app = my_application_new();
return g_application_run(G_APPLICATION(app), argc, argv);
}
5 changes: 5 additions & 0 deletions app/macos/Runner/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ class AppDelegate: FlutterAppDelegate {
public override func application(_ application: NSApplication,
continue userActivity: NSUserActivity,
restorationHandler: @escaping ([any NSUserActivityRestoring]) -> Void) -> Bool {
#if DEBUG
print("This app works in debug mode")
#else
print("This app works in release mode")
#endif

guard let url = AppLinks.shared.getUniversalLink(userActivity) else {
return false
Expand Down
5 changes: 5 additions & 0 deletions app/windows/runner/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@

int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev,
_In_ wchar_t *command_line, _In_ int show_command) {
#ifdef _DEBUG
println("This app works in debug mode");
#else
println("This app works in release mode");
#endif

HWND hwnd = ::FindWindow(L"FLUTTER_RUNNER_WIN32_WINDOW", L"Acter");
if (hwnd != NULL) {
Expand Down
Loading