kyranf / robotarmyfactorio

A mod to add robot troop units and perhaps associated support buildings and items to produce and control them.
MIT License
35 stars 11 forks source link

Error while running the on_init: __robotarmy__/stdlib/log/logger.lua:66: #48

Closed alicia86 closed 8 years ago

alicia86 commented 8 years ago

Getting an error when trying to load up game for the first time with mod. Full error: Error while running the on_init: robotarmy/stdlib/log/logger.lua:66: Scripts can only use file space inside of C (requested path was C:/Users\%USERNAME%\AppData\Roaming\Factorio\script-output\logs/robotarmy/robot_army_logs.log)

alicia86 commented 8 years ago

I did try manually creating the file since it apparently didn't exist yet and still not working.

kyranf commented 8 years ago

Can you try launching factorio as administrator?

alicia86 commented 8 years ago

I run through steam.. is there a way to force it do so? Edit: I've tried going through the \Steam\steamapps\common\Factorio\bin\x64\factorio.exe and in properties/compatibility checking the Run as Adminstrator option and that didn't seem to do anything

kyranf commented 8 years ago

It looks like you did the right thing there. Are you on linux or windows? do you have Steam (and Factorio) installed on C: drive?

I'm going to forward this on to the creator for stdlib, he might know what to do. The Github page for Factorio Stdlib is here: https://github.com/Afforess/Factorio-Stdlib

I will try to contact Afforess over IRC first though. Please give some time for me to check this out.

alicia86 commented 8 years ago

Well I think I figured it out.. I had a mklink set up so my game files for Factorio would get loaded to dropbox and apparently your mod didn't like that. Anyway to get it so it won't throw a fit anymore?

kyranf commented 8 years ago

It's the way the modding API works and the "permissions" that Factorio Lua scripts have, in terms of making output log files. The framework is not mine, it's Afforess' and we use it for logging events in the mods for debugging. It's possible that the file path is being redirected through the link to an area where Factorio (or at least lua scripts in mods in factorio) do not have permission to write files there.

Are you able to remove the link just for the script-outputs folder?

It's just a lot of work for adjusting the mod files to correctly remove all logging (which is the last thing you could try). In the source files of my mod (control.lua, and check all files in the robolib folder) find each line that contains "LOGGER.log" and comment them out with a "--" in front of the line, just like all the other comments in the files.

alicia86 commented 8 years ago

Yes, I can just requires a separate mklink for each folder and would miss out on the files in the root path (though I'm not sure how important those are to back up) It's good to know that that the logging is permission based. Maybe I'll try fiddling around with the permissions to the dropbox folder it's going to.

kyranf commented 8 years ago

It's permissions controlled within Factorio - it's permissions on a Factorio -> Mods interaction level, not necessarily a permissions issue with Factorio and Windows. Basically, Mods are only allowed to write to a specific location, and any path other than that is rejected and errors thrown. This is a Factorio game limitation in that regard, but a logical one. I don't think they were expecting people to redirect the files like that lol.

Choumiko commented 8 years ago

Pasted from irc, but i think the subfolder idea is already mentioned here (just quickly glanced over it, tldr xD)

Choumiko: that's more an issue of windows/ntfs/symlinks/junctions and/or Factorio's way of handling it i think. Tell him to try using /c game.write_file("filename.txt", "sometext") in the console. If that fails (i think it will) it's a Factorio bug Choumiko: hmm, fails with a symlink on linux too xD Choumiko: a subdirectory inside script-output works as a symlink, so maybe that will work as a workaround under windows too (symlinking the logs folder)

I think except for screenshots (are they even written into script-output?) and exported blueprints from blueprintstring/foreman script-output isn't really necessary since mods can only write to it and not read.

Afforess commented 8 years ago

@kyranf would have better faster to just tag me on Github. I get email notices. :)

kyranf commented 8 years ago

Well if we didn't come to a conclusion was going to post an issue on your report which would have sent you an email.. will tag you next time!

Afforess commented 8 years ago

Report opened with Factorio: https://forums.factorio.com/viewtopic.php?f=7&t=30250#p191172

Occurs w/o any mods.

kyranf commented 8 years ago

@alicia86 So as it's a Factorio issue and we have an ongoing Factorio bug report now thanks to Afforess, I'm going to close this issue. You can monitor the progress of that Factorio forum thread for possible workarounds or indication if it's been fixed for a future version.