Beispiel #1
0
        protected string GetTexturePath(string baseDirectory, Texture texture)
        {
            var texturePath         = _getTexturePathCallback(texture);
            var relativeTexturePath = PathC.GetRelativePath(baseDirectory, texturePath);

            if (relativeTexturePath == null || relativeTexturePath == "")
            {
                return(texturePath);
            }
            return(relativeTexturePath);
        }
Beispiel #2
0
        public string MakeRelative(string path, VariableType baseDirType)
        {
            if (string.IsNullOrEmpty(path))
            {
                return(null);
            }

            try
            {
                if (string.IsNullOrEmpty(LevelFilePath))
                {
                    return(Path.GetFullPath(path));
                }

                switch (baseDirType)
                {
                case VariableType.EditorDirectory:
                case VariableType.GameDirectory:
                case VariableType.LevelDirectory:
                case VariableType.ScriptDirectory:
                    string relativePath = PathC.GetRelativePath(GetVariable(baseDirType), path);
                    if (relativePath == null)
                    {
                        return(Path.GetFullPath(path));
                    }
                    return(VariableCreate(baseDirType) + Path.DirectorySeparatorChar + relativePath);

                default:
                    return(path);
                }
            }
            catch
            {
                return(path);
            }
        }