Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ MoveTo()

void System.IO.DirectoryInfo.MoveTo ( string destDirName)
inline

Definition at line 212 of file DirectoryInfo.cs.

213 {
214 if (destDirName == null)
215 {
216 throw new ArgumentNullException("destDirName");
217 }
218 if (destDirName.Length == 0)
219 {
220 throw new ArgumentException(SR.Argument_EmptyFileName, "destDirName");
221 }
222 string fullPath = Path.GetFullPath(destDirName);
223 string text = PathInternal.EnsureTrailingSeparator(fullPath);
224 string text2 = PathInternal.EnsureTrailingSeparator(FullPath);
225 if (string.Equals(text2, text, PathInternal.StringComparison))
226 {
227 throw new IOException(SR.IO_SourceDestMustBeDifferent);
228 }
229 string pathRoot = Path.GetPathRoot(text2);
230 string pathRoot2 = Path.GetPathRoot(text);
231 if (!string.Equals(pathRoot, pathRoot2, PathInternal.StringComparison))
232 {
233 throw new IOException(SR.IO_SourceDestMustHaveSameRoot);
234 }
235 if (!Exists && !FileSystem.FileExists(FullPath))
236 {
237 throw new DirectoryNotFoundException(SR.Format(SR.IO_PathNotFound_Path, FullPath));
238 }
239 if (FileSystem.DirectoryExists(fullPath))
240 {
241 throw new IOException(SR.Format(SR.IO_AlreadyExists_Name, text));
242 }
243 FileSystem.MoveDirectory(FullPath, fullPath);
245 Invalidate();
246 }
void Init(string originalPath, string fullPath=null, string fileName=null, bool isNormalized=false)

References System.SR.Argument_EmptyFileName, System.IO.FileSystem.DirectoryExists(), System.IO.PathInternal.EnsureTrailingSeparator(), System.IO.FileSystemInfo.Exists, System.IO.FileSystem.FileExists(), System.SR.Format(), System.IO.FileSystemInfo.FullPath, System.IO.Path.GetFullPath(), System.IO.Path.GetPathRoot(), System.IO.DirectoryInfo.Init(), System.IO.FileSystemInfo.Invalidate(), System.SR.IO_AlreadyExists_Name, System.SR.IO_PathNotFound_Path, System.SR.IO_SourceDestMustBeDifferent, System.SR.IO_SourceDestMustHaveSameRoot, System.IO.FileSystem.MoveDirectory(), System.IO.PathInternal.StringComparison, and System.text.