I'm trying to make a mod, and I'm trying to create a text file as a log file to help me develop it, but if I set the .techniclauncher/technicssp folder to be not read-only, the launcher just makes it read-only again, so I'm not able to create the file.
How can I disable this behaviour?
EDIT: Seems the problem is actually that the working directory is set not to the technicssp folder but to the directory the launcher is in. I need to find a way to get the path to the minecraft folder so I can read multiple mods' config files there.
EDIT AGAIN: For the edification of future generations, here's some code that works. I don't like that this is rather a hack, but it may actually be the most portable and reliable way to do it cross-OS. (Thank you, StackExchange.)
You can post now and register later.
If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.
Question
jakj
I'm trying to make a mod, and I'm trying to create a text file as a log file to help me develop it, but if I set the .techniclauncher/technicssp folder to be not read-only, the launcher just makes it read-only again, so I'm not able to create the file.
How can I disable this behaviour?
EDIT: Seems the problem is actually that the working directory is set not to the technicssp folder but to the directory the launcher is in. I need to find a way to get the path to the minecraft folder so I can read multiple mods' config files there.
EDIT AGAIN: For the edification of future generations, here's some code that works. I don't like that this is rather a hack, but it may actually be the most portable and reliable way to do it cross-OS. (Thank you, StackExchange.)
import java.net.URLDecoder ; public class mod_Whatever extends BaseMod { public static String BaseWorkingPath ; @Override public void load ( ) { try { BaseWorkingPath = net.minecraft.client.Minecraft . class . getProtectionDomain ( ) . getCodeSource ( ) . getLocation ( ) . getPath ( ) ; BaseWorkingPath = URLDecoder . decode ( BaseWorkingPath , "UTF-8" ) ; BaseWorkingPath = BaseWorkingPath . substring ( 0 , BaseWorkingPath . lastIndexOf ( '/' ) ) ; BaseWorkingPath = BaseWorkingPath . substring ( 0 , BaseWorkingPath . lastIndexOf ( '/' ) + 1 ) ; } catch ( UnsupportedEncodingException e ) { e . printStackTrace ( ) ; } } }0 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.