mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-24 05:03:34 -04:00
Don't forget to create useful sub-directories in extra directory. (Thanks Empy)
This commit is contained in:
parent
273a2496dc
commit
94f50a4aaf
@ -29,9 +29,10 @@ namespace MCGalaxy.Commands.World {
|
||||
if (message.Length == 0) { Help(p); return; }
|
||||
if (!Formatter.ValidName(p, message, "level")) return;
|
||||
|
||||
string file = "extra/import/" + message;
|
||||
if (!Directory.Exists("extra/import"))
|
||||
Directory.CreateDirectory("extra/import");
|
||||
string file = Paths.ImportsDir + message;
|
||||
if (!Directory.Exists(Paths.ImportsDir)) {
|
||||
Directory.CreateDirectory(Paths.ImportsDir);
|
||||
}
|
||||
|
||||
foreach (IMapImporter importer in IMapImporter.Formats) {
|
||||
if (!File.Exists(file + importer.Extension)) continue;
|
||||
|
@ -16,10 +16,8 @@
|
||||
permissions and limitations under the Licenses.
|
||||
*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
using MCGalaxy.Blocks;
|
||||
using MCGalaxy.DB;
|
||||
using MCGalaxy.Drawing;
|
||||
using MCGalaxy.Drawing.Brushes;
|
||||
|
@ -61,7 +61,7 @@ namespace MCGalaxy.Core {
|
||||
|
||||
static void LoadWaypoints(Player p) {
|
||||
try {
|
||||
p.Waypoints.Filename = "extra/Waypoints/" + p.name + ".save";
|
||||
p.Waypoints.Filename = Paths.WaypointsDir + p.name + ".save";
|
||||
p.Waypoints.Load();
|
||||
} catch (IOException ex) {
|
||||
Player.Message(p, "Error loading waypoints.");
|
||||
|
@ -27,6 +27,7 @@ using MCGalaxy.Games;
|
||||
using MCGalaxy.Network;
|
||||
using MCGalaxy.Tasks;
|
||||
using MCGalaxy.Util;
|
||||
using MCGalaxy.Scripting;
|
||||
|
||||
namespace MCGalaxy {
|
||||
public sealed partial class Server {
|
||||
@ -142,17 +143,24 @@ namespace MCGalaxy {
|
||||
}
|
||||
|
||||
static void EnsureFilesExist() {
|
||||
if (!Directory.Exists("properties")) Directory.CreateDirectory("properties");
|
||||
if (!Directory.Exists("levels")) Directory.CreateDirectory("levels");
|
||||
if (!Directory.Exists("bots")) Directory.CreateDirectory("bots");
|
||||
if (!Directory.Exists("text")) Directory.CreateDirectory("text");
|
||||
EnsureDirectoryExists("properties");
|
||||
EnsureDirectoryExists("levels");
|
||||
EnsureDirectoryExists("bots");
|
||||
EnsureDirectoryExists("text");
|
||||
RankInfo.EnsureExists();
|
||||
Ban.EnsureExists();
|
||||
|
||||
if (!Directory.Exists("extra")) Directory.CreateDirectory("extra");
|
||||
if (!Directory.Exists("extra/Waypoints")) Directory.CreateDirectory("extra/Waypoints");
|
||||
if (!Directory.Exists("extra/bots")) Directory.CreateDirectory("extra/bots");
|
||||
if (!Directory.Exists("blockdefs")) Directory.CreateDirectory("blockdefs");
|
||||
EnsureDirectoryExists("extra");
|
||||
EnsureDirectoryExists(Paths.WaypointsDir);
|
||||
EnsureDirectoryExists("extra/bots");
|
||||
EnsureDirectoryExists(Paths.ImportsDir);
|
||||
EnsureDirectoryExists("blockdefs");
|
||||
EnsureDirectoryExists(IScripting.DllDir);
|
||||
EnsureDirectoryExists(IScripting.SourceDir);
|
||||
}
|
||||
|
||||
static void EnsureDirectoryExists(string dir) {
|
||||
if (!Directory.Exists(dir)) Directory.CreateDirectory(dir);
|
||||
}
|
||||
|
||||
static void MoveOutdatedFiles() {
|
||||
|
@ -44,5 +44,8 @@ namespace MCGalaxy {
|
||||
public const string RankPropsFile = "properties/ranks.properties";
|
||||
|
||||
public const string BotsFile = "extra/bots.json";
|
||||
|
||||
public const string ImportsDir = "extra/import/";
|
||||
public const string WaypointsDir = "extra/Waypoints/";
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user