usnistgov / REFPROP-wrappers

Wrappers around NIST REFPROP for languages such as Python, MATLAB, etc.
193 stars 127 forks source link

Mathcad Wrapper Can't Find Custom Mixture (.MIX) Files Created with GUI #465

Closed henningjp closed 2 years ago

henningjp commented 2 years ago

Description

Custom mixtures created with the REFPROP GUI cannot be found with the Mathcad wrapper on Windows.

Steps to Reproduce

  1. Create a Custom Mixture in the REFPROP GUI
  2. Save it
  3. Make sure the REFPROP GUI can find and read the custom .mix file just saved
  4. Try and open that custom mix file in Mathcad using the Mathcad wrapper

Expected behavior: Open the custom mixture file and use it, just like the REFPROP GUI does

Actual behavior: Mathcad wrapper throws error: Fluid/Mixture not found.

image

Versions

REFPROP Version: 10
Operating System and Version: Windows 10
Access Method: Mathcad wrapper v2.0.1

Additional Information

Clue was gleaned from @EricLemmon response to issue #325. Custom mixture file is indeed being stored in the user's Virtual Store directory at: C:\Users\UserName\AppData\Local\VirtualStore\Program Files (x86)\REFPROP\MIXTURES. This happens because the C: drive is "security hardened" and won't let programs write to the Program Files areas.

It would be nice if SETMIXdll handled this eventuality on its own. However, @henningjp will issue a patch to have the Mathcad wrapper check for this file in the current user's Virtual Store if the file is not found in the default mixtures directory. If found, the full file path to the custom mixture will be provided to SETMIXdll instead of letting SETMIXdll try to find the file.