bool UGameInstance::HandleOpenCommand(const TCHAR* Cmd, FOutputDevice& Ar, UWorld* InWorld) { check(WorldContext && WorldContext->World() == InWorld); UEngine* const Engine = GetEngine(); FURL TestURL(&WorldContext->LastURL, Cmd, TRAVEL_Absolute); if (TestURL.IsLocalInternal()) { // make sure the file exists if we are opening a local file if (!Engine->MakeSureMapNameIsValid(TestURL.Map)) { Ar.Logf(TEXT("ERROR: The map '%s' does not exist."), *TestURL.Map); return true; } } Engine->SetClientTravel(InWorld, Cmd, TRAVEL_Absolute); return true; }
long GetProcDir(std::string & Dest) { CFAuto<CFURLRef> TestURL( CFBundleCopyExecutableURL(CFBundleGetMainBundle())); CFAuto<CFStringRef> PathCFString( CFURLCopyFileSystemPath(TestURL,kCFURLPOSIXPathStyle)); long PathLen = CFStringGetLength(PathCFString) + 1; char PathString[PathLen]; //AutoCharBuf PathString(PathLen); CFStringGetCString(PathCFString, PathString, PathLen ,kCFStringEncodingUTF8); char* PathTerm = strrchr(PathString, '/'); if (PathTerm != NULL) *(PathTerm + 1) = '\0'; Dest = PathString; return 0; }