SA-MP Forums Archive
Folder creating? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Folder creating? (/showthread.php?tid=270897)



Folder creating? - [WF]Demon - 22.07.2011

Hi, I've been trying for hours but I can't seem to find out how to make a folder...

For example I have

scriptfiles/blahblah/

and I want to make a folder in there thats name whatever so it will be like

scriptfiles/blahblah/whatever/

how would I do that?


Re: Folder creating? - Kitten - 22.07.2011

File System like
Y_INI
DINI
etc..


Re: Folder creating? - [WF]Demon - 22.07.2011

Obviously but dini nor y_ini uses a different method then this

pawn Код:
fopen("blahblah/whatever/", io_readwrite);
Which doesn't work...


Re: Folder creating? - Kitten - 22.07.2011

Quote:
Originally Posted by [WF]Demon
Посмотреть сообщение
Obviously but dini nor y_ini uses a different method then this

pawn Код:
fopen("blahblah/whatever/", io_readwrite);
Which doesn't work...
i don't think it will auto create the folder for you , you must create for example

pawn Код:
format(SaveVar, sizeof(SaveVar), "/Files/%s.ini",name); // example
the folder Files must be created then the other stuff will be created in that folder.


Re: Folder creating? - [WF]Demon - 22.07.2011

I've attempted that.

pawn Код:
format(file, sizeof(file), "blahblah/%s/blah.txt", pname);
new File:fileopen = fopen(file, io_readwrite);
fclose(fileopen);
Crashes the server.


Re: Folder creating? - Kitten - 22.07.2011

Quote:
Originally Posted by [WF]Demon
Посмотреть сообщение
I've attempted that.

pawn Код:
format(file, sizeof(file), "blahblah/%s/blah.txt", pname);
new File:fileopen = fopen(file, io_readwrite);
fclose(fileopen);
Crashes the server.
Should'nt %s be %s.ini or is it a folder?


AW: Folder creating? - Meta - 22.07.2011

Use FileManager made by JaTochNietDan
dir_create(directory[]);


Re: Folder creating? - 0x5A656578 - 22.07.2011

You can do this with this plugin: http://files.jatochnietdan.com/?view...ecute%20Plugin

So if you're running a Windows server:

pawn Код:
exec("mkdir scriptfiles\\blahblah");
or on Linux (notice forward slash):

pawn Код:
exec("mkdir scriptfiles/blahblah");