mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-15 13:14:17 +01:00
Move WriteAllTextSafe to correct location
This commit is contained in:
parent
c305c01dfd
commit
2b2a027fb0
1 changed files with 16 additions and 16 deletions
|
|
@ -610,6 +610,22 @@ public static class Util
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Overwrite text in a file by first writing it to a temporary file, and then
|
||||||
|
/// moving that file to the path specified.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="path">The path of the file to write to.</param>
|
||||||
|
/// <param name="text">The text to write.</param>
|
||||||
|
public static void WriteAllTextSafe(string path, string text)
|
||||||
|
{
|
||||||
|
var tmpPath = path + ".tmp";
|
||||||
|
if (File.Exists(tmpPath))
|
||||||
|
File.Delete(tmpPath);
|
||||||
|
|
||||||
|
File.WriteAllText(tmpPath, text);
|
||||||
|
File.Move(tmpPath, path, true);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Dispose this object.
|
/// Dispose this object.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -645,22 +661,6 @@ public static class Util
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Overwrite text in a file by first writing it to a temporary file, and then
|
|
||||||
/// moving that file to the path specified.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="path">The path of the file to write to.</param>
|
|
||||||
/// <param name="text">The text to write.</param>
|
|
||||||
public static void WriteAllTextSafe(string path, string text)
|
|
||||||
{
|
|
||||||
var tmpPath = path + ".tmp";
|
|
||||||
if (File.Exists(tmpPath))
|
|
||||||
File.Delete(tmpPath);
|
|
||||||
|
|
||||||
File.WriteAllText(tmpPath, text);
|
|
||||||
File.Move(tmpPath, path, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a random, inoffensive, human-friendly string.
|
/// Gets a random, inoffensive, human-friendly string.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue