@@ -61,9 +61,7 @@ public override void OnInspectorGUI() {
61
61
// Unless the user canceled, make sure they chose something in the Assets folder.
62
62
if ( ! string . IsNullOrEmpty ( fullPath ) ) {
63
63
var relativePath = ExportSettings . ConvertToAssetRelativePath ( fullPath ) ;
64
- if ( string . IsNullOrEmpty ( relativePath )
65
- || relativePath == ".."
66
- || relativePath . StartsWith ( ".." + Path . DirectorySeparatorChar ) ) {
64
+ if ( string . IsNullOrEmpty ( relativePath ) ) {
67
65
Debug . LogWarning ( "Please select a location in the Assets folder" ) ;
68
66
} else {
69
67
ExportSettings . SetRelativeSavePath ( relativePath ) ;
@@ -153,10 +151,21 @@ public static void SetRelativeSavePath(string newPath) {
153
151
/// get from GetRelativeSavePath.
154
152
///
155
153
/// This uses '/' as the path separator.
154
+ ///
155
+ /// If 'requireSubdirectory' is the default on, return empty-string if the full
156
+ /// path is not in a subdirectory of assets.
156
157
/// </summary>
157
- public static string ConvertToAssetRelativePath ( string fullPathInAssets )
158
+ public static string ConvertToAssetRelativePath ( string fullPathInAssets , bool requireSubdirectory = true )
158
159
{
159
- return GetRelativePath ( Application . dataPath , fullPathInAssets ) ;
160
+ var relativePath = GetRelativePath ( Application . dataPath , fullPathInAssets ) ;
161
+ if ( requireSubdirectory && relativePath . StartsWith ( ".." ) ) {
162
+ if ( relativePath . Length == 2 || relativePath [ 2 ] == '/' ) {
163
+ // The relative path has us pop out to another directory,
164
+ // so return an empty string as requested.
165
+ return "" ;
166
+ }
167
+ }
168
+ return relativePath ;
160
169
}
161
170
162
171
/// <summary>
0 commit comments