Minecraft Mod to create files and folders -


i'm creating mod minecraft. it's computer mod , need store files , folders user creates on computer computers own personal folder. each instance of computer folder computers number created , folder of files , folders inside of specific computer loacated instance: folders in directory c:/mc/mods first computer have folder c:/mc/mods/1 second c:/mc/mods/2 , on computercraft does. problem despite many attempts , research have been able create neither folders nor files. here code looks upon block being placed.

file file = new file("c:/mc/mods"); if (file.isdirectory() == false) {     file.mkdir(); } string s = "c:/mc/mods/1"; file = new file(s); int iii = 2; while (file.isdirectory()) {     string ss = s.substring(0,s.length() - 1);     s = ss + iii;     file = new file(s);     iii += 1; } file.mkdir(); file = new file("c:/mc/mods/locs.txt"); try { file.createnewfile(); } catch (exception e) {     system.out.println(e); } try { printwriter outp = new printwriter(new bufferedwriter(new filewriter("c:/mc/mods/locs.txt",true))); outp.println(x + "," + y + "," + z + "," + integer.tostring(iii - 1)); outp.close(); } catch (exception e) {     system.out.println(e); } 

it makes sure have main folder created, creates subfolder specific computer , in main folder logs exact position , number of computer. if me out figuring out how correctly great thanks. i'm pretty new java sorry of bad performance coding i'm fixing.

it appears attempting write @ root ("c:/") without administrator permission. try basing file directory off of minecraft.getworkingdirectory (i not remember exact method).

it's impossible know sure have not provided sort of log, hope works.


Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

What is the difference between data design and data model(ERD) -

ios - Can NSManagedObject conform to NSCoding -