File tree Expand file tree Collapse file tree 4 files changed +16
-14
lines changed
Expand file tree Collapse file tree 4 files changed +16
-14
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -510,12 +510,9 @@ void WriteWifiConnectionStatus() {
510510 }
511511
512512 string GetFilePath ( string fileName ) {
513- var filesPath = Path . Combine ( Application . dataPath . Replace ( "Assets" , "Files" ) ) ;
514- if ( ! Directory . Exists ( filesPath ) )
515- throw new DirectoryNotFoundException ( "Ensure Files/ directory inside Unity project" ) ;
516- var mightyDir = Path . Combine ( filesPath , "MightyImmersion" ) ;
513+ var mightyDir = Path . Combine ( MXRStorage . ExternalStorageDirectory , "MightyImmersion" ) ;
517514 if ( ! Directory . Exists ( mightyDir ) )
518- throw new DirectoryNotFoundException ( "Ensure Files/ MightyImmersion directory inside Unity project " ) ;
515+ throw new DirectoryNotFoundException ( "Ensure MightyImmersion directory exists in ManageXR Unity SDK Samples " ) ;
519516 return Path . Combine ( mightyDir , fileName ) ;
520517 }
521518
Original file line number Diff line number Diff line change @@ -12,8 +12,20 @@ public static class MXRStorage {
1212 /// </summary>
1313 public static string ExternalStorageDirectory {
1414 get {
15- if ( Application . isEditor )
16- return Application . dataPath . Replace ( "Assets" , "Files" ) ;
15+ if ( Application . isEditor ) {
16+ var samplesPath = Path . Combine ( Application . dataPath , "Samples" , "ManageXR Unity SDK" ) ;
17+ if ( ! Directory . Exists ( samplesPath ) )
18+ throw new System . Exception ( $ "No ManageXR Unity SDK Samples found in the project") ;
19+ var dirs = Directory . GetDirectories ( samplesPath , "*" , SearchOption . TopDirectoryOnly ) ;
20+
21+ foreach ( var dir in dirs ) {
22+ var target = Path . Combine ( dir , "Samples" , "Files" ) ;
23+ if ( Directory . Exists ( target ) ) {
24+ return target ;
25+ }
26+ }
27+ throw new System . Exception ( $ "No ManageXR Unity SDK Samples found in the project") ;
28+ }
1729 else {
1830 var path = new AndroidJavaClass ( "android.os.Environment" )
1931 . SafeCallStatic < AndroidJavaObject > ( "getExternalStorageDirectory" )
You can’t perform that action at this time.
0 commit comments