Log.Warn("Load(): " + _assemblyPath + " ++");
NUIGadgetAssemblyLoadContext context = new NUIGadgetAssemblyLoadContext();
_assemblyRef = new WeakReference(context);
- string directoryPath = SystemIO.Path.GetDirectoryName(_assemblyPath);
- string fileName = SystemIO.Path.GetFileNameWithoutExtension(_assemblyPath);
- string nativeImagePath = directoryPath + "/.native_image/" + fileName + ".ni.dll";
- Log.Debug("NativeImagePath=" + nativeImagePath + ", AssemblyPath=" + _assemblyPath);
- _assembly = context.LoadFromNativeImagePath(nativeImagePath, _assemblyPath);
+ using (FileStream stream = new FileStream(_assemblyPath, FileMode.Open, FileAccess.Read))
+ {
+ _assembly = context.LoadFromStream(stream);
+ }
Log.Warn("Load(): " + _assemblyPath + " --");
}
}
}
}
}
-}
\ No newline at end of file
+}
using System;
using System.Collections.Generic;
using System.ComponentModel;
+using System.IO;
using System.Reflection;
using System.Runtime.InteropServices;
using Tizen.Applications;
get; private set;
}
+ /// <summary>
+ /// Gets the allowed resourced path of the gadget.
+ /// </summary>
+ /// <since_tizen> 12 </since_tizen>
+ public string AllowedResourcePath
+ {
+ get; private set;
+ }
+
/// <summary>
/// Gets the executable file of the gadget.
/// </summary>
}
info.ResourcePath = SystemIO.Path.GetDirectoryName(Application.Current.ApplicationInfo.ExecutablePath) + "/";
+ info.AllowedResourcePath = SystemIO.Path.GetDirectoryName(Application.Current.DirectoryInfo.Resource) + "/mount/allowed/" + info.ResourceType + "/";
+ if (!Directory.Exists(info.AllowedResourcePath))
+ {
+ info.AllowedResourcePath = SystemIO.Path.GetDirectoryName(Application.Current.DirectoryInfo.Resource) + "/mount/allowed/";
+ }
return info;
}
}
{
if (info.NUIGadgetAssembly == null || !info.NUIGadgetAssembly.IsLoaded)
{
- Log.Warn("NUIGadgetAssembly.Load(): " + info.ResourcePath + info.ExecutableFile + " ++");
- info.NUIGadgetAssembly = new NUIGadgetAssembly(info.ResourcePath + info.ExecutableFile);
+ Log.Warn("NUIGadgetAssembly.Load(): " + info.AllowedResourcePath + info.ExecutableFile + " ++");
+ info.NUIGadgetAssembly = new NUIGadgetAssembly(info.AllowedResourcePath + info.ExecutableFile);
info.NUIGadgetAssembly.Load();
- Log.Warn("NUIGadgetAssembly.Load(): " + info.ResourcePath + info.ExecutableFile + " --");
+ Log.Warn("NUIGadgetAssembly.Load(): " + info.AllowedResourcePath + info.ExecutableFile + " --");
}
}
}