Posts: 77
Threads: 11
Joined: Dec 2013
Reputation:
0
Hey
I have a little problem. I have create a INI dynamic mapping system in game.
The admin can save the project like "mapping1" and it saved in the scriptfiles
how to load many .txt files when server start ? The server must recover the files present and load them
thanks
Posts: 10,066
Threads: 38
Joined: Sep 2007
Reputation:
0
If the files can be named whatever the user wants then you have no way of retrieving the names of those files because there isn't a native that can list the directory contents. There are certain file manager plugins that may provide the solution but I don't know how up-to-date those are or even if they work across different operating system.
Another potential solution is to store a list of filenames inside another (flat) file. That file can then be read with a simple "while fread" loop. The downside is that problems will start to arise as soon as you want to modify or remove one of those filenames. This involves a lot of string comparison, which is already fairly slow, and then the entire file needs to be rewritten. This gets worse as the file grows larger.
Consider using SQL (SQLite) if you want something more durable.
Posts: 77
Threads: 11
Joined: Dec 2013
Reputation:
0
It's not possible to load a FOLDER with all .txt in this folder ?