Skip to content

Commit

Permalink
Merge pull request #10 from planetarium/fix/create-directory-for-editor
Browse files Browse the repository at this point in the history
Editor updated
  • Loading branch information
greymistcube authored Jun 22, 2022
2 parents 17b4e51 + ae4196e commit a01939f
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 1,123 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,5 @@ Desktop.ini
.env

# Unity Build
/out/*
out/*
debug.txt
2 changes: 1 addition & 1 deletion UniLibplanet/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Assets/AssetStoreTools*
# Autogenerated VS/MD/Consulo solution and project files
ExportedObj/
.consulo/
# *.csproj
*.csproj
*.unityproj
*.sln
*.suo
Expand Down
1,121 changes: 0 additions & 1,121 deletions UniLibplanet/Assembly-CSharp-Editor.csproj

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public static void CreateGenesisBlock()
{
const string title = "Create genesis block";
string path = Paths.GenesisBlockPath;
DirectoryInfo directory = new DirectoryInfo(Path.GetDirectoryName(path));

if (File.Exists(path))
{
Expand All @@ -58,6 +59,11 @@ public static void CreateGenesisBlock()
}
}

if (!directory.Exists)
{
directory.Create();
}

// TODO: Allow creating a genesis block with transactions.
Utils.CreateGenesisBlock(path);
EditorUtility.DisplayDialog(title, "New genesis block created.", "Close");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public static void CreatePrivateKey()
{
const string title = "Create private key";
string path = Paths.PrivateKeyPath;
DirectoryInfo directory = new DirectoryInfo(Path.GetDirectoryName(path));

if (File.Exists(path))
{
Expand All @@ -61,6 +62,11 @@ public static void CreatePrivateKey()
}
}

if (!directory.Exists)
{
directory.Create();
}

Utils.CreatePrivateKey(path);
EditorUtility.DisplayDialog(title, "New private key created.", "Close");
}
Expand Down Expand Up @@ -199,6 +205,12 @@ public void OnGUI()
if (_valid)
{
string path = Paths.TempPrivateKeysPath;
DirectoryInfo directory = new DirectoryInfo(Path.GetDirectoryName(path));
if (!directory.Exists)
{
directory.Create();
}

using (StreamWriter stream = new StreamWriter(path, true, Encoding.UTF8))
{
stream.WriteLine(_saveText);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public static void CreateSwarmConfig()
{
const string title = "Create swarm config";
string path = Paths.SwarmConfigPath;
DirectoryInfo directory = new DirectoryInfo(Path.GetDirectoryName(path));

if (File.Exists(path))
{
Expand All @@ -57,6 +58,11 @@ public static void CreateSwarmConfig()
}
}

if (!directory.Exists)
{
directory.Create();
}

Utils.CreateSwarmConfig(path);
EditorUtility.DisplayDialog(title, "New swarm config created.", "Close");
}
Expand Down

0 comments on commit a01939f

Please sign in to comment.