Ejemplo n.º 1
0
 /// <summary>
 /// Checks if the path is valid
 /// </summary>
 /// <param name="inPath"></param>
 /// <returns>True if this path is relative</returns>
 public static bool IsRelative(string inPath)
 {
     using (FStringUnsafe inPathUnsafe = new FStringUnsafe(inPath))
     {
         return(Native_FPaths.IsRelative(ref inPathUnsafe.Array));
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Checks if the directory exists
 /// </summary>
 /// <param name="inPath"></param>
 /// <returns>True if this directory was found, false otherwise</returns>
 public static bool DirectoryExists(string inPath)
 {
     using (FStringUnsafe inPathUnsafe = new FStringUnsafe(inPath))
     {
         return(Native_FPaths.DirectoryExists(ref inPathUnsafe.Array));
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Convert all / and \ to TEXT("/")
 /// </summary>
 /// <param name="inPath"></param>
 public static void NormalizeFilename(ref string inPath)
 {
     using (FStringUnsafe inPathUnsafe = new FStringUnsafe(inPath))
     {
         Native_FPaths.NormalizeFilename(ref inPathUnsafe.Array);
         inPath = inPathUnsafe.Value;
     }
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Checks if two paths are the same.
 /// </summary>
 /// <param name="pathA">PathA First path to check.</param>
 /// <param name="pathB">PathB Second path to check.</param>
 /// <returns>True if both paths are the same. False otherwise.</returns>
 public static bool IsSamePath(string pathA, string pathB)
 {
     using (FStringUnsafe pathAUnsafe = new FStringUnsafe(pathA))
         using (FStringUnsafe pathBUnsafe = new FStringUnsafe(pathB))
         {
             return(Native_FPaths.IsSamePath(ref pathAUnsafe.Array, ref pathBUnsafe.Array));
         }
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Removes duplicate slashes in paths.
 /// Assumes all slashes have been converted to TEXT('/').
 /// For example, takes the string:
 ///  BaseDirectory/SomeDirectory//SomeOtherDirectory////Filename.ext
 /// and converts it to:
 ///  BaseDirectory/SomeDirectory/SomeOtherDirectory/Filename.ext
 /// </summary>
 /// <param name="inPath"></param>
 public static void RemoveDuplicateSlashes(ref string inPath)
 {
     using (FStringUnsafe inPathUnsafe = new FStringUnsafe(inPath))
     {
         Native_FPaths.RemoveDuplicateSlashes(ref inPathUnsafe.Array);
         inPathUnsafe.Value = inPath;
     }
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Sets the path to the project file.
 /// </summary>
 /// <param name="newGameProjectFilePath">The project file path to set.</param>
 public static void SetProjectFilePath(string newGameProjectFilePath)
 {
     using (FStringUnsafe newGameProjectFilePathUnsafe = new FStringUnsafe(newGameProjectFilePath))
     {
         // Make sure this doesn't hold onto the address of this string
         Native_FPaths.SetProjectFilePath(ref newGameProjectFilePathUnsafe.Array);
     }
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Takes an "Unreal" pathname and converts it to a platform filename.
 /// </summary>
 /// <param name="inPath"></param>
 public static void MakePlatformFilename(ref string inPath)
 {
     using (FStringUnsafe inPathUnsafe = new FStringUnsafe(inPath))
     {
         Native_FPaths.MakePlatformFilename(ref inPathUnsafe.Array);
         inPathUnsafe.Value = inPath;
     }
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Gets thhe relative path to get from BaseDir to RootDirectory
 /// </summary>
 /// <returns></returns>
 public static string GetRelativePathToRoot()
 {
     using (FStringUnsafe resultUnsafe = new FStringUnsafe())
     {
         Native_FPaths.GetRelativePathToRoot(ref resultUnsafe.Array);
         return(resultUnsafe.Value);
     }
 }
Ejemplo n.º 9
0
 /// <summary>
 /// Normalize all / and \ to TEXT("/") and remove any trailing TEXT("/") if the character before that is not a TEXT("/") or a colon
 /// </summary>
 /// <param name="inPath"></param>
 public static void NormalizeDirectoryName(ref string inPath)
 {
     using (FStringUnsafe inPathUnsafe = new FStringUnsafe(inPath))
     {
         Native_FPaths.NormalizeDirectoryName(ref inPathUnsafe.Array);
         inPathUnsafe.Value = inPath;
     }
 }
Ejemplo n.º 10
0
 /// <summary>
 /// Returns the path in front of the filename
 /// </summary>
 /// <param name="inPath"></param>
 /// <returns></returns>
 public static string GetPath(string inPath)
 {
     using (FStringUnsafe inPathUnsafe = new FStringUnsafe(inPath))
         using (FStringUnsafe resultUnsafe = new FStringUnsafe())
         {
             Native_FPaths.GetPath(ref inPathUnsafe.Array, ref resultUnsafe.Array);
             return(resultUnsafe.Value);
         }
 }
Ejemplo n.º 11
0
 /// <summary>
 /// Gets the extension for this filename.
 /// </summary>
 /// <param name="inPath"></param>
 /// <param name="includeDot">if true, includes the leading dot in the result</param>
 /// <returns></returns>
 public static string GetExtension(string inPath, bool includeDot = false)
 {
     using (FStringUnsafe inPathUnsafe = new FStringUnsafe(inPath))
         using (FStringUnsafe resultUnsafe = new FStringUnsafe())
         {
             Native_FPaths.GetExtension(ref inPathUnsafe.Array, includeDot, ref resultUnsafe.Array);
             return(resultUnsafe.Value);
         }
 }
Ejemplo n.º 12
0
 /// <summary>
 /// Converts a relative path name to a fully qualified name relative to the process BaseDir().
 /// </summary>
 /// <param name="inPath"></param>
 /// <returns></returns>
 public static string ConvertRelativePathToFull(string inPath)
 {
     using (FStringUnsafe inPathUnsafe = new FStringUnsafe(inPath))
         using (FStringUnsafe resultUnsafe = new FStringUnsafe())
         {
             Native_FPaths.ConvertRelativePathToFull(ref inPathUnsafe.Array, ref resultUnsafe.Array);
             return(resultUnsafe.Value);
         }
 }
Ejemplo n.º 13
0
 /// <summary>
 /// Takes a fully pathed string and eliminates relative pathing (eg: annihilates ".." with the adjacent directory).
 /// Assumes all slashes have been converted to TEXT('/').
 /// For example, takes the string:
 ///  BaseDirectory/SomeDirectory/../SomeOtherDirectory/Filename.ext
 /// and converts it to:
 ///  BaseDirectory/SomeOtherDirectory/Filename.ext
 /// </summary>
 /// <param name="inPath"></param>
 /// <returns></returns>
 public static bool CollapseRelativeDirectories(ref string inPath)
 {
     using (FStringUnsafe inPathUnsafe = new FStringUnsafe(inPath))
     {
         bool result = Native_FPaths.CollapseRelativeDirectories(ref inPathUnsafe.Array);
         inPathUnsafe.Value = inPath;
         return(result);
     }
 }
Ejemplo n.º 14
0
 /// <summary>
 /// Returns the same thing as GetCleanFilename, but without the extension
 /// </summary>
 /// <param name="inPath"></param>
 /// <param name="removePath"></param>
 /// <returns></returns>
 public static string GetBaseFilename(string inPath, bool removePath = true)
 {
     using (FStringUnsafe inPathUnsafe = new FStringUnsafe(inPath))
         using (FStringUnsafe resultUnsafe = new FStringUnsafe())
         {
             Native_FPaths.GetBaseFilename(ref inPathUnsafe.Array, removePath, ref resultUnsafe.Array);
             return(resultUnsafe.Value);
         }
 }
Ejemplo n.º 15
0
 /// <summary>
 /// Changes the extension of the given filename
 /// </summary>
 /// <param name="inPath"></param>
 /// <param name="inNewExtension"></param>
 /// <returns></returns>
 public static string ChangeExtension(string inPath, string inNewExtension)
 {
     using (FStringUnsafe inPathUnsafe = new FStringUnsafe(inPath))
         using (FStringUnsafe inNewExtensionUnsafe = new FStringUnsafe(inNewExtension))
             using (FStringUnsafe resultUnsafe = new FStringUnsafe())
             {
                 Native_FPaths.ChangeExtension(ref inPathUnsafe.Array, ref inNewExtensionUnsafe.Array, ref resultUnsafe.Array);
                 return(resultUnsafe.Value);
             }
 }
Ejemplo n.º 16
0
 /// <summary>
 /// Parses a fully qualified or relative filename into its components (filename, path, extension).
 /// </summary>
 /// <param name="inPath"></param>
 /// <param name="pathPart">[out] receives the value of the path portion of the input string</param>
 /// <param name="filenamePart">[out] receives the value of the filename portion of the input string</param>
 /// <param name="extensionPart">[out] receives the value of the extension portion of the input string</param>
 public static void Split(string inPath, ref string pathPart, ref string filenamePart, ref string extensionPart)
 {
     using (FStringUnsafe inPathUnsafe = new FStringUnsafe(inPath))
         using (FStringUnsafe pathPartUnsafe = new FStringUnsafe(pathPart))
             using (FStringUnsafe filenamePartUnsafe = new FStringUnsafe(filenamePart))
                 using (FStringUnsafe extensionPartUnsafe = new FStringUnsafe(extensionPart))
                 {
                     Native_FPaths.Split(ref inPathUnsafe.Array, ref pathPartUnsafe.Array, ref filenamePartUnsafe.Array, ref extensionPartUnsafe.Array);
                 }
 }
Ejemplo n.º 17
0
 /// <summary>
 /// Validates that the parts that make up the path contain no invalid characters as dictated by the operating system
 /// Note that this is a different set of restrictions to those imposed by FPackageName
 /// </summary>
 /// <param name="inPath">path to validate</param>
 /// <param name="reason">optional parameter to fill with the failure reason</param>
 /// <returns></returns>
 public static bool ValidatePath(string inPath, out string reason)
 {
     using (FStringUnsafe reasonUnsafe = new FStringUnsafe())
         using (FStringUnsafe inPathUnsafe = new FStringUnsafe(inPath))
         {
             bool result = Native_FPaths.ValidatePath(ref inPathUnsafe.Array, ref reasonUnsafe.Array);
             reason = reasonUnsafe.Value;
             return(result);
         }
 }
Ejemplo n.º 18
0
 /// <summary>
 /// Converts a normal path to a sandbox path (in Saved/Sandboxes).
 /// </summary>
 /// <param name="inPath"></param>
 /// <param name="inSandboxName">The name of the sandbox.</param>
 /// <returns></returns>
 public static string ConvertToSandboxPath(string inPath, string inSandboxName)
 {
     using (FStringUnsafe inPathUnsafe = new FStringUnsafe(inPath))
         using (FStringUnsafe inSandboxNameUnsafe = new FStringUnsafe(inSandboxName))
             using (FStringUnsafe resultUnsafe = new FStringUnsafe())
             {
                 Native_FPaths.ConvertFromSandboxPath(ref inPathUnsafe.Array, ref inSandboxNameUnsafe.Array, ref resultUnsafe.Array);
                 return(resultUnsafe.Value);
             }
 }
Ejemplo n.º 19
0
 /// <summary>
 /// Assuming both paths (or filenames) are relative to the base dir, find the relative path to the InPath.
 /// </summary>
 /// <param name="inPath">Path to make this path relative to.</param>
 /// <param name="inRelativeTo">Path relative to InPath</param>
 /// <returns></returns>
 public static bool MakePathRelativeTo(ref string inPath, string inRelativeTo)
 {
     using (FStringUnsafe inPathUnsafe = new FStringUnsafe(inPath))
         using (FStringUnsafe inRelativeToUnsafe = new FStringUnsafe(inRelativeTo))
         {
             bool result = Native_FPaths.MakePathRelativeTo(ref inPathUnsafe.Array, ref inRelativeToUnsafe.Array);
             inPath = inPathUnsafe.Value;
             return(result);
         }
 }
Ejemplo n.º 20
0
 /// <summary>
 /// Creates a temporary filename with the specified prefix.
 /// </summary>
 /// <param name="path">The file pathname.</param>
 /// <param name="prefix">The file prefix.</param>
 /// <param name="extension">File extension ('.' required).</param>
 /// <returns></returns>
 public static string CreateTempFilename(string path, string prefix = "", string extension = ".tmp")
 {
     using (FStringUnsafe pathUnsafe = new FStringUnsafe(path))
         using (FStringUnsafe prefixUnsafe = new FStringUnsafe(prefix))
             using (FStringUnsafe extensionUnsafe = new FStringUnsafe(extension))
                 using (FStringUnsafe resultUnsafe = new FStringUnsafe())
                 {
                     Native_FPaths.CreateTempFilename(ref pathUnsafe.Array, ref prefixUnsafe.Array, ref extensionUnsafe.Array, ref resultUnsafe.Array);
                     return(resultUnsafe.Value);
                 }
 }
Ejemplo n.º 21
0
 public static string Combine(params string[] paths)
 {
     if (paths != null && paths.Length > 0)
     {
         string result = paths[0];
         using (FStringUnsafe pathAUnsafe = new FStringUnsafe())
             using (FStringUnsafe pathBUnsafe = new FStringUnsafe())
                 using (FStringUnsafe resultUnsafe = new FStringUnsafe())
                 {
                     for (int i = 1; i < paths.Length; i++)
                     {
                         pathAUnsafe.Value = result;
                         pathBUnsafe.Value = paths[i];
                         Native_FPaths.Combine(ref pathAUnsafe.Array, ref pathBUnsafe.Array, ref resultUnsafe.Array);
                         result = resultUnsafe.Value;
                     }
                 }
         return(result);
     }
     return(null);
 }
Ejemplo n.º 22
0
 /// <summary>
 /// Returns a list of game-specific localization paths
 /// </summary>
 /// <returns></returns>
 public static string[] GetGameLocalizationPaths()
 {
     return(GetStringArray(Native_FPaths.GetGameLocalizationPaths()));
 }