# Shipping build won't create .ini file in GameDir()

**URL:** <https://forums.unrealengine.com/t/shipping-build-wont-create-ini-file-in-gamedir/99905>\
**Category:** Mobile\
**Tags:** unreal-engine, Android\
**Created:** [September 14, 2017, 11:57am UTC](https://forums.unrealengine.com/t/shipping-build-wont-create-ini-file-in-gamedir/99905 "2017-09-14T11:57:47Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_4230003f](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_4230003f](https://forums.unrealengine.com/u/anonymous_user_4230003f)\
**Post date:** [September 14, 2017, 11:57am UTC](https://forums.unrealengine.com/t/shipping-build-wont-create-ini-file-in-gamedir/99905/1 "2017-09-14T11:57:47Z")

</div>

I’m trying to create a file in the root game folder in Android, but when I package it as shipping, it doesn’t create the file. I’ve also set up the permissions to **WRITE\_EXTERNAL\_STORAGE** and **READ\_EXTERNAL\_STORAGE**. If I’m packaging as Development build it creates the file. So what DO I do?

This is the code that I’m using:

```
//FString ThePath = FString(FPlatformProcess::BaseDir());
IPlatformFile& PlatformFile = FPlatformFileManager::Get().GetPlatformFile();

FString SaveDirectory = FPaths::GameDir();
FString FileName = FString("Feydom.ini");
FString TextToSave = FString("Test");
FString AbsoluteFilePath = SaveDirectory + "/" + FileName;

// CreateDirectoryTree returns true if the destination
// directory existed prior to call or has been created
// during the call.
if (PlatformFile.CreateDirectoryTree(*SaveDirectory))
{
    bool Success = FFileHelper::SaveStringToFile(TextToSave, *AbsoluteFilePath);
    if (Success)
    {
        UE_LOG(LogTemp, Display, TEXT("Success creating and writing to file at path %s"), *AbsoluteFilePath);
        return true;
    }
    else
    {
        UE_LOG(LogTemp, Error, TEXT("Failure creating and writing to file at path %s"), *AbsoluteFilePath);
        return false;
    }
}
else
{
    UE_LOG(LogTemp, Error, TEXT("Cant't create directory at path %s "), *AbsoluteFilePath);
    return false;
}

```

---

<div class="post-metadata">

**Author:** ![Chris\_Babcock](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Chris\_Babcock](https://forums.unrealengine.com/u/Chris_Babcock)\
**Post date:** [September 14, 2017, 11:16pm UTC](https://forums.unrealengine.com/t/shipping-build-wont-create-ini-file-in-gamedir/99905/2 "2017-09-14T23:16:50Z")

</div>

Use FAndroidMisc::GamePersistentDownloadDir() instead of FPaths::GameDir().

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_4230003f](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_4230003f](https://forums.unrealengine.com/u/anonymous_user_4230003f)\
**Post date:** [September 15, 2017, 7:24am UTC](https://forums.unrealengine.com/t/shipping-build-wont-create-ini-file-in-gamedir/99905/3 "2017-09-15T07:24:33Z")

</div>

> [@Chris\_Babcock](#):
>
> Use FAndroidMisc::GamePersistentDownloadDir() instead of FPaths::GameDir().

Great! Thank you, this is exactly what I needed 🙂
