KspPathsMakeRelativePathToGameData Method  | 
 Returns path relative to the game's GameData folder.
 
    Namespace: 
   KSPDev.FSUtils
    Assembly:
   KSPDev_Utils.2.3 (in KSPDev_Utils.2.3.dll) Version: 2.3 for KSP v1
Syntaxpublic static string MakeRelativePathToGameData(
	params string[] pathParts
)
 Request Example
		View SourceParameters
- pathParts
 - Type: SystemString
Path parts tp consutruct an absolute or relative path. 
Return Value
Type: 
String
            Relative path. All relative casts (e.g. '..') will be resolved, and all
            directory separators will be translated to 
/ regardless to the platform settings.
            
Remarks
            Note that method doesn't care if the path exists. The returned path will always use /
            as directory separator regardless to the platform.
            
Examples
            Let's say mod's exact location is not known (e.g. as it is for MiniAVC) and the mod needs to
            load a texture. In order to do it the mod needs to know a 
GameData relative path which
            can be used as a prefix to the texture. Below is a sample code that figures it out.
            
var assembly = Assembly.GetExecutingAssembly();
var relPath = KspPaths.MakeRelativePathToGameData(assembly.Location);
Debug.LogWarningFormat("Assembly {0} is loaded from {1}", assembly.FullName, relPath);
var textureFolder = KspPaths.NormalizePath(Path.GetDirectoryName(relPath) + "/../Textures");
var texture = GameDatabase.Instance.GetTexture(textureFolder + "/MyTexture.png", false);
See Also