Path issue while executing the .exe file
I'm successfully creating the .exe file with ocran, but when I run it, the script does it from the temporary folder, instead from the directory where the script is stored. How can I change this behaviour?
If you add this to the beginning of your app, it will always be in the expected directory. Hope this helps
if ENV.has_key?("OCRAN_EXECUTABLE") and not defined?(Ocran)
$mainDirectory = File.dirname(ENV["OCRAN_EXECUTABLE"].to_s)
Dir.chdir($mainDirectory)
elsif not defined?(Ocran)
$mainDirectory = __dir__
Dir.chdir($mainDirectory)
elsif defined?(Ocran) and not ENV.has_key?("OCRAN_EXECUTABLE")
$mainDirectory = __dir__
Dir.chdir($mainDirectory)
end
I also think this behaviour is confusing, maybe we can improve it.
Thanks, but I'm afraid it still doesn't work. It keeps reading from the temporary folder :(
Okay, strange. Can you maybe share some sample code?
Also, if you could tell me the gem version, that would be helpful too.
Hey! Here you have the full script. It's a simple tool that reads one or more XLSX files, takes data and generate one single .CSV file.
Lokalize_WC_generator_FINAL.zip XLS_files.zip
With the executable, I could pretty much easily run the script to the XLSX files every time I need it.
Gem version: Ocran 1.3.16
Let me know what you find out, thanks!