28 namespace Ntp.Analyzer.Export
32 public static uint? FileUserId = null;
33 public static uint? FileGroupId = null;
34 public static uint FileMask = 644;
38 if (FileUserId != null)
44 log.DestinationOwnerError(file);
49 log.DestinationOwnerError(file, e);
57 log.DestinationPermissionError(file);
62 log.DestinationPermissionError(file, e);
66 protected static string JoinPath(
string path1,
string path2)
68 string a = path1 ??
string.Empty;
69 string b = path2 ??
string.Empty;
71 a = a.TrimEnd(Path.DirectorySeparatorChar).TrimEnd(Path.AltDirectorySeparatorChar);
72 b = b.TrimStart(Path.DirectorySeparatorChar).TrimStart(Path.AltDirectorySeparatorChar);
74 string c =
string.Concat(a, Path.DirectorySeparatorChar, b);
78 protected static string JoinPath(
string path1,
string path2,
string path3)
80 return JoinPath(JoinPath(path1, path2), path3);
85 string created = null;
92 log.DestinationPathError(file, e);
97 log.DestinationNewDirectory(created);
100 if (
File.Exists(file))
104 protected static void TestFile(
string file,
string content)
106 if (
File.Exists(file))
109 File.WriteAllText(file, content);
117 using (var fileStream =
new FileStream(file, FileMode.CreateNew))
118 stream.CopyTo(fileStream);
124 log.DestinationFileError(file, e);
131 Replace(Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar);
static bool ChangeFileMode(string file, uint mode)
static void TestFile(string file, string content)
static void WriteFile(Stream stream, string file, LogBase log)
static string CreateRecursiveFromFile(string file)
static void ApplyPermissions(string file, LogBase log)
static string JoinPath(string path1, string path2, string path3)
static string ScrubPath(string path)
static void PrepareFile(string file, LogBase log)
static string JoinPath(string path1, string path2)
static bool ChangeFileOwner(string file, uint user, uint?group)