Skip to content

Improve DLL search path fixer.#39

Merged
DuFF14 merged 4 commits intomasterfrom
adjust-search-path
Mar 31, 2015
Merged

Improve DLL search path fixer.#39
DuFF14 merged 4 commits intomasterfrom
adjust-search-path

Conversation

@rpavlik
Copy link
Copy Markdown
Member

@rpavlik rpavlik commented Mar 30, 2015

  • Use a class to keep track of state.
  • Use the Unity Application data dir property instead of current directory + "Assets"
  • Handle looking in x86 vs x86_64 - does not fully fix the 64-bit support but it's one step.

@DuFF14 can you test this with Unity Pro and make sure it works, both in the editor and the compiled build player? It should solve the issue of looking in the wrong place in compiled builds.

rpavlik added 2 commits March 30, 2015 16:01
- Use a class to keep track of state.
- Use the Unity Application data dir property instead of current directory + "Assets"
- Handle looking in x86 vs x86_64 - does not fully fix the 64-bit support but it's one step.
@DuFF14
Copy link
Copy Markdown
Member

DuFF14 commented Mar 30, 2015

It works, in the editor and the build!
I did get an error when opening Unity:

ArgumentException: get_dataPath can only be called from the main thread.
Constructors and field initializers will be executed from the loading thread when loading a scene.
Don't use this function in the constructor or field initializers, instead move initialization code to the Awake or Start function.
OSVR.Unity.DLLSearchPathFixer..ctor () (at Assets/OSVRUnity/src/DLLSearchPathFixer.cs:54)
OSVR.Unity.DLLSearchPathFixer.fix () (at Assets/OSVRUnity/src/DLLSearchPathFixer.cs:40)
OSVR.Unity.ClientKit..cctor () (at Assets/OSVRUnity/src/ClientKit.cs:83)
Rethrow as TypeInitializationException: An exception was thrown by the type initializer for OSVR.Unity.ClientKit

@rpavlik
Copy link
Copy Markdown
Member Author

rpavlik commented Mar 30, 2015

Oh rats, so that means either we can't use the data dir property, or we have to adjust where we're calling the fixer from.

@DuFF14
Copy link
Copy Markdown
Member

DuFF14 commented Mar 31, 2015

Moving DLLSearchPathFixer.fix(); from the static constructor to the Awake() function makes the error go away and everything still works.

DuFF14 added a commit that referenced this pull request Mar 31, 2015
Improve DLL search path fixer.
@DuFF14 DuFF14 merged commit a184206 into master Mar 31, 2015
@rpavlik rpavlik deleted the adjust-search-path branch May 14, 2015 19:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants