Jump to content

Recommended Posts

Posted

I have problems using getFileWriter() in build 32(.3):

 

Relative paths are forebidden now, so I have to change to direct paths.

Before this build, I used ".."..File.separator.."mods"..File.separator ... to

write a file in my ModData-Subdirectory of my ModDirectory.

 

But now, if I give the whole direct path with Core.getMyDocumentFolder()..File.separator .."mods"..File.separator.."KoregansServerMod"..File.separator.."ModData"

I get errors, because the local path C:\Users\Andi\Zomboid\Lua\ is standing in front of my direct path.

 

ERROR in console:

java.io.FileNotFoundException: C:\Users\Andi\Zomboid\Lua\C:\Users\Andi\Zomboid\m
ods\KoregansServerMod\ModData\Playerlist\11-58-58_PlayerList.txt (Die Syntax f³r
 den Dateinamen, Verzeichnisnamen oder die Datentrõgerbezeichnung ist falsch)

 

Is there a way to set files in my moddirectory instead of zomboid\lua\ ?

 

Posted

But I think there should be access to your own moddirectory.

 

(In the version before (b31), my mod was able to create files in my moddirectory and chatlogs in "Zomboid\Multiplayer".)

 

So if the "local path" would be changed to "Zomboid" instead of "Zomboid\Lua"

then it would be also sure that no files outside would be changed.

Posted

Thank you Brybry for this information. Didn't know this way or function.

 

For all modders which have / had the same problems a short explaination of getModFileWriter

 

getModFileWriter(String modId, String filename, boolean createIfNull, boolean append )

 

modId has to be the id of your mod (written as in mod.info), then the file "filename" will be written direct in your moddirectory.

Posted

'filename' can be a path too so you aren't limited to writing in the root of your mod directory (ex. 'media/lua/foobar.txt')

  • 1 month later...
Posted

'filename' can be a path too so you aren't limited to writing in the root of your mod directory (ex. 'media/lua/foobar.txt')

Is getModFileWriter present in both Build 31 and 32, or is it a new Build 32 feature?

Posted

 

'filename' can be a path too so you aren't limited to writing in the root of your mod directory (ex. 'media/lua/foobar.txt')

Is getModFileWriter present in both Build 31 and 32, or is it a new Build 32 feature?

 

It's in both. It's actually been around since before build 28.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...