open.mp forum
[Pawn] possible to create a folder inside scriptfiles? - Printable Version

+ open.mp forum (https://forum.open.mp)
-- Forum: SA-MP (https://forum.open.mp/forumdisplay.php?fid=3)
--- Forum: Pawn Scripting (https://forum.open.mp/forumdisplay.php?fid=10)
--- Thread: [Pawn] possible to create a folder inside scriptfiles? (/showthread.php?tid=2319)



possible to create a folder inside scriptfiles? - mems - 2022-09-12

hello,



title possibly explains exactly what i want. i'm looking to make a function that checks if there is a specific named folder on the scriptfiles folder. if there isn't, then it simply creates that folder. tried searching for a library that could help me but apart from filemanager which probably also doesn't do what i'm asking for i couldn't find anything else. grateful if anyone helps!


RE: possible to create a folder inside scriptfiles? - Kwarde - 2022-09-13

So you want to check if:

- A directory exists or not

and if not:

- Create it



Quote:apart from filemanager which probably also doesn't do what i'm asking for

What kind of stupid assumption is that? Did you even check out the plugin? It can do exactly what you want:



Code:
if (!dir_exists("scriptfiles/my_directory/"))

{

? ? dir_create("scriptfiles/my_directory/");

}



If you meant you want a function that does both things at once you'd have to create your own function.

And that's as simple as this:

Code:
dir_check(const dirname[])

{

? ? if (!dir_exists(dirname))

? ? {

? ? ? ? dir_create(dirname);

? ? }

}

Code:
dir_check("scriptfiles/my_directory.");



Consider using this one?https://github.com/JarnoKai/SA-MP-FileManager/


RE: possible to create a folder inside scriptfiles? - mems - 2022-09-13

(2022-09-13, 05:34 AM)Kwarde Wrote: So you want to check if:
- A directory exists or not
and if not:
- Create it

correct.

Quote:What kind of stupid assumption is that? Did you even check out the plugin? It can do exactly what you want:

i did try it but it ended up sending an error message on server start up. here's the error:

Code:
Script[gamemodes/fps.amx]: Run time error 19: "File or function is not found"

and no matter if i use that version
Quote:https://github.com/JarnoKai/SA-MP-FileManager
or JaTochNietDan's version, the error will still pop up, even though there are no errors when compiling.


RE: possible to create a folder inside scriptfiles? - mems - 2022-09-16

nevermind, i had to install its plugin... thanks for helping anyway