本文整理汇总了C++中FileSystem::GetProgramDir方法的典型用法代码示例。如果您正苦于以下问题:C++ FileSystem::GetProgramDir方法的具体用法?C++ FileSystem::GetProgramDir怎么用?C++ FileSystem::GetProgramDir使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileSystem
的用法示例。
在下文中一共展示了FileSystem::GetProgramDir方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Build
void BuildIOS::Build(const String& buildPath)
{
buildPath_ = buildPath + "/IOS-Build";
Initialize();
FileSystem* fileSystem = GetSubsystem<FileSystem>();
if (fileSystem->DirExists(buildPath_))
fileSystem->RemoveDir(buildPath_, true);
#ifdef ATOMIC_PLATFORM_WINDOWS
String buildSourceDir = fileSystem->GetProgramDir();
#else
String buildSourceDir = fileSystem->GetAppBundleResourceFolder();
#endif
String buildAppSourceDir = buildSourceDir + "Deployment/IOS/AtomicPlayer.app";
fileSystem->CreateDir(buildPath_);
String buildDestDist = buildPath_ + "/AtomicPlayer.app";
fileSystem->CreateDir(buildDestDist);
String resourcePackagePath = buildDestDist + "/AtomicResources.pak";
GenerateResourcePackage(resourcePackagePath);
fileSystem->Copy(buildAppSourceDir + "/AtomicPlayer", buildDestDist + "/AtomicPlayer");
fileSystem->Copy(buildAppSourceDir + "/PkgInfo", buildDestDist + "/PkgInfo");
BuildSystem* buildSystem = GetSubsystem<BuildSystem>();
IOSBuildSettings settings = buildSystem->GetBuildSettings()->GetIOSSettings();
fileSystem->Copy(settings.provisionFile, buildDestDist + "/embedded.mobileprovision");
String entitlements = GenerateEntitlements();
String plist = GenerateInfoPlist();
File file(context_, buildPath_ + "/AtomicPlayer.app.xcent", FILE_WRITE);
if (file.IsOpen())
{
file.Write(entitlements.CString(), entitlements.Length());
file.Close();
}
File pfile(context_, buildDestDist + "/Info.plist", FILE_WRITE);
if (pfile.IsOpen())
{
pfile.Write(plist.CString(), plist.Length());
pfile.Close();
}
RunConvertPList();
}
示例2: Object
EditorData::EditorData(Context* context, Editor* editor) : Object(context),
editor_(editor)
{
FileSystem* fileSystem = GetSubsystem<FileSystem>();
uiSceneFilters.Push("*.xml");
uiSceneFilters.Push("*.bin");
uiSceneFilters.Push("*.*");
uiElementFilters.Push("*.xml");
uiAllFilters.Push("*.*");
uiScriptFilters.Push("*.*");
uiScriptFilters.Push("*.as");
uiScriptFilters.Push("*.lua");
uiParticleFilters.Push("*.xml");
uiRenderPathFilters.Push("*.xml");
uiSceneFilter = 0;
uiElementFilter = 0;
uiNodeFilter = 0;
uiImportFilter = 0;
uiScriptFilter = 0;
uiParticleFilter = 0;
uiRenderPathFilter = 0;
uiScenePath = fileSystem->GetProgramDir() + "Data/Scenes";
uiElementPath = fileSystem->GetProgramDir() + "Data/UI";
uiNodePath = fileSystem->GetProgramDir() + "Data/Objects";
uiScriptPath = fileSystem->GetProgramDir() + "Data/Scripts";
uiParticlePath = fileSystem->GetProgramDir() + "Data/Particles";
uiRenderPathPath = fileSystem->GetProgramDir() + "CoreData/RenderPaths";
screenshotDir = fileSystem->GetProgramDir() + "Screenshots";
}
示例3: ReadEngineConfig
void NETAtomicPlayer::ReadEngineConfig()
{
FileSystem* fileSystem = GetSubsystem<FileSystem>();
#ifdef ATOMIC_PLATFORM_OSX
String filename = fileSystem->GetProgramDir() + "../Resources/Settings/Engine.json";
#else
String filename = fileSystem->GetProgramDir() + "Settings/Engine.json";
#endif
if (!fileSystem->FileExists(filename))
return;
if (EngineConfig::LoadFromFile(context_, filename))
{
EngineConfig::ApplyConfig(engineParameters_, true);
}
}
示例4: Setup
void AEEditorApp::Setup()
{
context_->SetEditorContext(true);
ToolEnvironment* env = new ToolEnvironment(context_);
context_->RegisterSubsystem(env);
ToolSystem* system = new ToolSystem(context_);
context_->RegisterSubsystem(system);
#ifdef ATOMIC_DEV_BUILD
if (!env->InitFromJSON())
{
ErrorExit(ToString("Unable to initialize tool environment from %s", env->GetDevConfigFilename().CString()));
return;
}
#else
env->InitFromPackage();
#endif
engineParameters_["WindowTitle"] = "AtomicEditor";
engineParameters_["WindowResizable"] = true;
engineParameters_["FullScreen"] = false;
engineParameters_["LogLevel"] = LOG_DEBUG;
FileSystem* filesystem = GetSubsystem<FileSystem>();
engineParameters_["LogName"] = filesystem->GetAppPreferencesDir("AtomicEditor", "Logs") + "AtomicEditor.log";
#ifdef ATOMIC_PLATFORM_OSX
engineParameters_["WindowIcon"] = "Images/AtomicLogo32.png";
#endif
#ifdef ATOMIC_DEV_BUILD
engineParameters_["ResourcePrefixPath"] = "";
String ScriptPath = env->GetRootSourceDir() + "Script";
String resourcePaths = env->GetCoreDataDir() + ";" + env->GetEditorDataDir() + ";" + ScriptPath;
engineParameters_["ResourcePaths"] = resourcePaths;
#else
#ifdef ATOMIC_PLATFORM_OSX
engineParameters_["ResourcePrefixPath"] = "../Resources";
#else
engineParameters_["ResourcePrefixPath"] = filesystem->GetProgramDir() + "Resources";
#endif
engineParameters_["ResourcePaths"] = "CoreData;EditorData;Script";
#endif // ATOMIC_DEV_BUILD
}
示例5: SplashStatInit
void GameEconomicGameClientStateSplash::SplashStatInit(void)
{
/// Get Needed SubSystems
ResourceCache* cache = GetSubsystem<ResourceCache>();
Renderer* renderer = GetSubsystem<Renderer>();
Graphics* graphics = GetSubsystem<Graphics>();
UI* ui = GetSubsystem<UI>();
FileSystem * filesystem = GetSubsystem<FileSystem>();
/// Create variables (urho3d)
String InputDataFile;
InputDataFile.Append(filesystem->GetProgramDir().CString());
InputDataFile.Append("Resources/Scenes/");
InputDataFile.Append("Login1.xml");
bool success;
/// Check if the input data file exist
if(filesystem->FileExists(InputDataFile))
{
/// Open file as a Urho3d Datafile
dataFile = new File(context_, InputDataFile, FILE_READ);
if (dataFile -> IsOpen())
{
/// Get File Extension
String extension = GetExtension(InputDataFile);
/// Determine file extension
if (extension != ".xml")
{
///success= Existence-> scene_ -> Load(dataFile);
success = Existence-> scene_ -> LoadAsync(dataFile);
}
else
{
success= Existence-> scene_ ->LoadAsyncXML(dataFile);
}
}
else
{
/// set is error
success=false;
}
}
/// on update
SubscribeToEvent(E_UPDATE, HANDLER(GameEconomicGameClientStateSplash, HandlerSplashUpdate)); // Keep visible until rendering of the scene
return;
}
示例6: SaveConfiguration
/// Save account information to a file
void GameEconomicGameClient::SaveConfiguration(Configuration &configuration)
{
/// Get Resource
ResourceCache * cache = GetSubsystem<ResourceCache>();
FileSystem * fileSystem = GetSubsystem<FileSystem>();
String configFileName;
/// Set directory and path for network file
configFileName.Append(fileSystem->GetProgramDir().CString());
configFileName.Append("");
configFileName.Append("Configuration.xml");
/// Check if the account file information exist
if(fileSystem->FileExists(configFileName.CString()))
{
fileSystem->Delete(configFileName.CString());
}
cout << "It got here "<<endl;
File saveFile(context_, configFileName.CString(), FILE_WRITE);
XMLFile * preferencefileconfig = new XMLFile(context_);
XMLElement configElem = preferencefileconfig -> CreateRoot("Configuration");
XMLElement GameModeConfigurationElement = configElem.CreateChild("GameModeConfiguration");
XMLElement VideoConfigurationElement= configElem.CreateChild("VideoConfiguration");
/// Set true false
if(configuration.GameModeForceTablet==true)
{
GameModeConfigurationElement.SetAttribute("GameModeForceTablet", "true");
}
else
{
GameModeConfigurationElement.SetAttribute("GameModeForceTablet", "false");
}
/// Convert video bloom to float
String VideoBloomParamValue1String(configuration.VideoBloomParam1);
String VideoBloomParamValue2String(configuration.VideoBloomParam2);
/// Copy values testing
VideoConfigurationElement.SetAttribute("BloomParam1",VideoBloomParamValue1String);
VideoConfigurationElement.SetAttribute("BloomParam2",VideoBloomParamValue2String);
preferencefileconfig->Save(saveFile);
return;
}
示例7: ReadEngineConfig
void NETAtomicPlayer::ReadEngineConfig()
{
FileSystem* fileSystem = GetSubsystem<FileSystem>();
String filename = fileSystem->GetProgramDir() + "Settings/Engine.json";
if (!fileSystem->FileExists(filename))
return;
if (EngineConfig::LoadFromFile(context_, filename))
{
EngineConfig::ApplyConfig(engineParameters_, true);
}
}
示例8: Setup
void Player::Setup()
{
#if DESKTOP
FileSystem* fs = GetFileSystem();
engineParameters_[EP_RESOURCE_PREFIX_PATHS] = fs->GetProgramDir() + ";" + fs->GetCurrentDir();
#endif
engineParameters_[EP_RESOURCE_PATHS] = "Cache;Resources";
JSONFile file(context_);
if (!file.LoadFile(ToString("%s%s", APK, "Settings.json")))
return;
for (auto& pair : file.GetRoot().GetObject())
engineParameters_[pair.first] = pair.second.GetVariant();
}
示例9: file
bool UINewProject::Create2DProject(const String& projectPath, const String& filename)
{
FileSystem* fileSystem = GetSubsystem<FileSystem>();
#ifdef ATOMIC_PLATFORM_OSX
String templateSourceDir = fileSystem->GetAppBundleResourceFolder();
#else
String templateSourceDir = fileSystem->GetProgramDir();
#endif
templateSourceDir += "/ProjectTemplates/Project2D";
fileSystem->CopyDir(templateSourceDir + "/Resources", projectPath + "/Resources");
File file(context_, projectPath + "/" + filename + ".atomic", FILE_WRITE);
file.Close();
return true;
}
示例10: Setup
void AEEditorApp::Setup()
{
context_->SetEditorContext(true);
AEEditorCommon::Setup();
ToolEnvironment* env = GetSubsystem<ToolEnvironment>();
engineParameters_["WindowTitle"] = "AtomicEditor";
engineParameters_["WindowResizable"] = true;
engineParameters_["FullScreen"] = false;
engineParameters_["LogLevel"] = LOG_DEBUG;
FileSystem* filesystem = GetSubsystem<FileSystem>();
engineParameters_["LogName"] = filesystem->GetAppPreferencesDir("AtomicEditor", "Logs") + "AtomicEditor.log";
#ifdef ATOMIC_PLATFORM_OSX
engineParameters_["WindowIcon"] = "Images/AtomicLogo32.png";
#endif
#ifdef ATOMIC_DEV_BUILD
engineParameters_["ResourcePrefixPath"] = "";
String resourcePaths = env->GetCoreDataDir() + ";" + env->GetEditorDataDir();
// for dev builds, add the compile editor scripts from artifacts
resourcePaths += ";" + env->GetRootSourceDir() + "Artifacts/Build/Resources/EditorData/";
engineParameters_["ResourcePaths"] = resourcePaths;
#else
#ifdef ATOMIC_PLATFORM_OSX
engineParameters_["ResourcePrefixPath"] = "../Resources";
#else
engineParameters_["ResourcePrefixPath"] = filesystem->GetProgramDir() + "Resources";
#endif
engineParameters_["ResourcePaths"] = "CoreData;EditorData";
#endif // ATOMIC_DEV_BUILD
ReadPreferences();
}
示例11: Initialize
void BuildIOS::Initialize()
{
Editor* editor = GetSubsystem<Editor>();
Project* project = editor->GetProject();
FileSystem* fileSystem = GetSubsystem<FileSystem>();
#ifdef ATOMIC_PLATFORM_WINDOWS
String bundleResources = fileSystem->GetProgramDir();
#else
String bundleResources = fileSystem->GetAppBundleResourceFolder();
#endif
String projectResources = project->GetResourcePath();
String coreDataFolder = bundleResources + "CoreData/";
AddResourceDir(coreDataFolder);
AddResourceDir(projectResources);
BuildResourceEntries();
}
示例12: InitFromDistribution
bool ToolEnvironment::InitFromDistribution()
{
toolPrefs_->Load();
FileSystem* fileSystem = GetSubsystem<FileSystem>();
#ifdef ATOMIC_PLATFORM_WINDOWS
editorBinary_ = fileSystem->GetProgramDir() + "AtomicEditor.exe";
String resourcesDir = fileSystem->GetProgramDir() + "Resources/";
playerBinary_ = resourcesDir + "ToolData/Deployment/Windows/x64/AtomicPlayer.exe";
#elif ATOMIC_PLATFORM_LINUX
editorBinary_ = fileSystem->GetProgramDir() + "AtomicEditor";
String resourcesDir = fileSystem->GetProgramDir() + "Resources/";
playerBinary_ = resourcesDir + "ToolData/Deployment/Linux/AtomicPlayer";
#else
editorBinary_ = fileSystem->GetProgramDir() + "AtomicEditor";
String resourcesDir = GetPath(RemoveTrailingSlash(fileSystem->GetProgramDir())) + "Resources/";
playerAppFolder_ = resourcesDir + "ToolData/Deployment/MacOS/AtomicPlayer.app/";
#endif
resourceCoreDataDir_ = resourcesDir + "CoreData";
resourcePlayerDataDir_ = resourcesDir + "PlayerData";
toolDataDir_ = resourcesDir + "ToolData/";
// AtomicNET
#ifdef ATOMIC_DEBUG
String config = "Debug";
#else
String config = "Release";
#endif
atomicNETRootDir_ = resourcesDir + "ToolData/AtomicNET/";
atomicNETCoreAssemblyDir_ = atomicNETRootDir_ + config + "/";
#ifdef ATOMIC_PLATFORM_OSX
monoExecutableDir_ = "/Library/Frameworks/Mono.framework/Versions/Current/Commands/";
atomicNETNuGetBinary_ = monoExecutableDir_ + "nuget";
#endif
return true;
}
示例13: LoadCommunicationLogs
/// Load Communication Logs
bool GameEconomicGameClient::LoadCommunicationLogs(LogFormatType LogType, Vector<CommunicationLog> * TargetLogs)
{
/// Grab resources
FileSystem * fileSystem = GetSubsystem<FileSystem>();
bool success=false;
/// Create String
String configFileName;
/// Set directory and path for network file
configFileName.Append(fileSystem->GetProgramDir().CString());
configFileName.Append("CommunicationLogs/DefaultLogs.xml");
/// If file does not exist exit function with null structure
if (!fileSystem->FileExists(configFileName))
{
cout << "No file found communication log" << endl;
return false;
}
/// Flag file for loading and load
File loadFile(context_, configFileName, FILE_READ);
XMLFile * communicationXML = new XMLFile(context_);
communicationXML -> Load(loadFile);
XMLElement communicationRootElement = communicationXML->GetRoot();
/// If no configuration is set or no root
if (communicationRootElement.IsNull())
{
return false;
}
/// Setupload data
XMLElement TempLogElement;
String FormatText;
/// Log log format Personal
if(LogType == LogFormat_Personal)
{
FormatText.Append(String("PersonalLog"));
TempLogElement = communicationRootElement.GetChild(FormatText);
}
else
{
return false;
}
/// If no network server element return false;
while(!TempLogElement.IsNull())
{
/// Create a temporary log
CommunicationLog TempLog;
if (TempLogElement.HasAttribute("LogCreation")) TempLog.Creation= TempLogElement.GetInt("LogCreation");
if (TempLogElement.HasAttribute("LogTitle")) TempLog.Title = TempLogElement.GetAttribute("LogTitle");
if (TempLogElement.HasAttribute("LogText")) TempLog.Text = TempLogElement.GetAttribute("LogText");
TargetLogs->Push(TempLog);
cout << "Adding" << TempLog.Title.CString()<<endl;
/// Get next
TempLogElement=communicationRootElement.GetNext(FormatText);
}
return success;
}
示例14: PlayProject
bool EditorMode::PlayProject(String addArgs, bool debug)
{
FileSystem* fileSystem = GetSubsystem<FileSystem>();
ToolSystem* tsystem = GetSubsystem<ToolSystem>();
Project* project = tsystem->GetProject();
if (!project)
return false;
ToolEnvironment* env = GetSubsystem<ToolEnvironment>();
String playerBinary = env->GetEditorBinary();
// TODO: We need to configure project as managed
bool managed = false;
if (fileSystem->FileExists(project->GetResourcePath() + "AtomicProject.dll"))
{
managed = true;
playerBinary = env->GetAtomicNETManagedIPCPlayerBinary();
}
Vector<String> paths;
paths.Push(env->GetCoreDataDir());
paths.Push(env->GetPlayerDataDir());
paths.Push(project->GetResourcePath());
// fixme: this is for loading from cache
paths.Push(project->GetProjectPath());
paths.Push(project->GetProjectPath() + "Cache");
String resourcePaths;
resourcePaths.Join(paths, "!");
Vector<String> vargs;
String args = ToString("--player --project \"%s\"", AddTrailingSlash(project->GetProjectPath()).CString());
vargs = args.Split(' ');
if (managed)
{
vargs.Insert(0, ToString("\"%s\"", (fileSystem->GetProgramDir() + "Resources/").CString()));
vargs.Insert(0, "--resourcePrefix");
}
if (debug)
vargs.Insert(0, "--debug");
if (addArgs.Length() > 0)
vargs.Insert(0, addArgs.Split(' '));
String dump;
dump.Join(vargs, " ");
ATOMIC_LOGINFOF("Launching Broker %s %s", playerBinary.CString(), dump.CString());
IPC* ipc = GetSubsystem<IPC>();
playerBroker_ = ipc->SpawnWorker(playerBinary, vargs);
if (playerBroker_)
{
SubscribeToEvent(playerBroker_, E_IPCWORKERSTART, ATOMIC_HANDLER(EditorMode, HandleIPCWorkerStarted));
SubscribeToEvent(E_IPCPLAYERPAUSERESUMEREQUEST, ATOMIC_HANDLER(EditorMode, HandleIPCPlayerPauseResumeRequest));
SubscribeToEvent(E_IPCPLAYERUPDATESPAUSEDRESUMED, ATOMIC_HANDLER(EditorMode, HandleIPCPlayerUpdatesPausedResumed));
SubscribeToEvent(E_IPCPLAYERPAUSESTEPREQUEST, ATOMIC_HANDLER(EditorMode, HandleIPCPlayerPauseStepRequest));
SubscribeToEvent(E_IPCPLAYEREXITREQUEST, ATOMIC_HANDLER(EditorMode, HandleIPCPlayerExitRequest));
SubscribeToEvent(playerBroker_, E_IPCJSERROR, ATOMIC_HANDLER(EditorMode, HandleIPCJSError));
SubscribeToEvent(playerBroker_, E_IPCWORKEREXIT, ATOMIC_HANDLER(EditorMode, HandleIPCWorkerExit));
SubscribeToEvent(playerBroker_, E_IPCWORKERLOG, ATOMIC_HANDLER(EditorMode, HandleIPCWorkerLog));
}
return playerBroker_.NotNull();
}
示例15: CreateSVGSprite
Sprite* Sample::CreateSVGSprite(const String& file)
{
FileSystem* fileSystem = GetSubsystem<FileSystem>();
String exePath = fileSystem->GetProgramDir();
String svgfile = exePath + file;
if (!fileSystem->FileExists(svgfile))
return NULL;
NSVGimage *image = NULL;
NSVGrasterizer *rast = NULL;
int w, h;
LOGINFOF("parsing %s\n", svgfile.CString());
image = nsvgParseFromFile(svgfile.CString(), "px", 128.0f);
if (image == NULL) {
LOGERROR("Could not open SVG image.\n");
}
w = image->width;
h = image->height;
rast = nsvgCreateRasterizer();
if (rast == NULL) {
LOGERROR("Could not init rasterizer.\n");
}
rast->tessTol = 2.25f;
rast->distTol = 2.1f;
SharedPtr<Image> saveimage(new Image(context_));
saveimage->SetSize(w, h, 4);
LOGINFOF("rasterizing image %d x %d\n", w, h);
nsvgRasterize(rast, image, 0.0f, 0.0f, 1, saveimage->GetData(), w, h, w * 4);
nsvgDeleteRasterizer(rast);
nsvgDelete(image);
// Get logo texture
ResourceCache* cache = GetSubsystem<ResourceCache>();
Texture2D* logoTexture = new Texture2D(context_);
logoTexture->SetData(saveimage);
Sprite* logoSprite_ = new Sprite(context_);
// Set logo sprite texture
logoSprite_->SetTexture(logoTexture);
int textureWidth = logoTexture->GetWidth();
int textureHeight = logoTexture->GetHeight();
// Set logo sprite scale
logoSprite_->SetScale(256.0f / textureWidth);
// Set logo sprite size
logoSprite_->SetSize(textureWidth, textureHeight);
// Set logo sprite hot spot
logoSprite_->SetHotSpot(textureWidth / 2, textureHeight / 2);
// Set logo sprite alignment
logoSprite_->SetAlignment(HA_CENTER, VA_CENTER);
return logoSprite_;
}