Xinoi / DNASIC

Little SpaceGame for IT-Project
GNU General Public License v2.0
1 stars 0 forks source link

Settings.json #25

Closed Xinoi closed 2 years ago

Xinoi commented 2 years ago

the Game creates an extra assets folder in the already existing assets folder and saves the game files there (settings.json, GameData)

possible Solution: -> remove assets/ prefix from the Gdx.files.local paths | apparently doesn't work on Jans Pc -> maybe change .local to .internal

Jan130 commented 2 years ago

This is interesting since on my PC it uses the files in the normal assets folder.

Jan130 commented 2 years ago

Now I know why I used .local in the first place... When using .internal I get the error message "Cannot write to an internal file: assets\settings.json"

Xinoi commented 2 years ago

ok nice

Xinoi commented 2 years ago

so you can fix it ?

Xinoi commented 2 years ago

try changing it to ...files.internal("settings.json") and ...files.internal("GameData/...")

Xinoi commented 2 years ago
According to the [documentation of Libgdx FileHandle types](https://github.com/libgdx/libgdx/wiki/File-handling#file-storage-types), the Local and Internal FileHandles use a different path under the hood:
 - The Internal FileHandle is relative to the assets directory on Android and has a fall back to the ClassPath FileHandle. It is always read-only!
 - The Local FileHandle is relative to the internal (private) App-Storage on Android. You can use this FileHandle to read and write.

So basicly it is not possible to write to a file in the internal stoarage, use the local storage instead.
As you want to "ship" this file with your application, you might want to copy it from internal to local storage when the app is started for the first time, so that the application has read and write access to it.

ok you have to use local

Jan130 commented 2 years ago

Yeah but I don't understand why it creates a new folder on your PC...

Xinoi commented 2 years ago

i dont know either

Jan130 commented 2 years ago

I tried it again and it works normally on my computer

Xinoi commented 2 years ago

well it works on mine with the extra folder so right now its not neccessary to change it. Mabye we can fix it in the end if we have time

Jan130 commented 2 years ago

Yeah I also hope to be able to sync the GameData via a database later so we would only have to care about the settings. For those there would be another solution so I could change that later.

Xinoi commented 2 years ago

aight