#pragma once using namespace System; using namespace System::ComponentModel; namespace Sunlight { __sealed __gc public class Utility { public: static Utility() { #ifdef _UNICODE LPWSTR tszAppPath = (LPWSTR)(void *)System::Runtime::InteropServices::Marshal::StringToCoTaskMemUni(System::Windows::Forms::Application::ExecutablePath); #else LPSTR tszAppPath = (LPSTR)(void *)System::Runtime::InteropServices::Marshal::StringToCoTaskMemAnsi(System::Windows::Forms::Application::ExecutablePath); #endif PathRemoveFileSpec(tszAppPath); AppPath = new String(tszAppPath); PathAddBackslash(tszAppPath); AppPathWithBackslash = new String(tszAppPath); CoTaskMemFree(tszAppPath); } static String *AppPath; static String *AppPathWithBackslash; }; }