Ruby Shoes App packaged for Windows doesn't display images - ruby

When I package my Shoes App for Windows images doesn't work. I have this very simple app (min_test.rb):
Shoes.app()
{
background "bg.jpg"
}
Which works fine if I run it through Shoes, but when I package it with Shoes so that I get a standalone .exe file the images doesn't load. Inside the folder these are the contents:
min_test.rb
bg.jpg
min_test.exe (after packaging)

If Shoes3.3.1, indeed, on linux too.
console (alt-/) saying "couldn't find tmp.....bg.jpg" ?
(background or image)
could you file a bug report, please : https://github.com/Shoes3/shoes3/issues
EDIT: Sorry, wait
if Shoes3.3.1 !
you have to first make a shy then an exe and the resulting exe will be outside of the directory where your script and image is.
follow this : https://github.com/Shoes3/shoes3/wiki/Packaging
(note: tested on linux and on Windows)

Related

Application doesn't launch from ZeroBrane Studio

I'm having a lot of problems with ZeroBraneStudio!
I enjoyed using it to write my first application on Windows, but now I fail to make it working on MacBook Air and even on WIndows after reinstalling Solar2D and ZeroBrane!
If I launch my app opening Corona Simulator everythings works well, but ZeroBrane doesn't work. The errors on MacBook and on Windows are similar.
On MacBook:
Program starting as '"/Applications/Corona-3664/Native/Corona/mac/bin/lua" -e "io.stdout:setvbuf('no')" "/var/folders/4w/hn6pxl5s20v31f0q2n9msjs40000gn/T/.bO0D1R"'.
Program 'lua' started in '/Applications/Corona-3664' (pid: 1638).
Debugging session started in '/Applications/Corona-3664/'.
SampleCode/Interface/Composer/main.lua:18: module 'composer' not found:
no field package.preload['composer']
no file './composer.lua'
no file '/usr/local/share/lua/5.1/composer.lua'
no file '/usr/local/share/lua/5.1/composer/init.lua'
no file '/usr/local/lib/lua/5.1/composer.lua'
no file '/usr/local/lib/lua/5.1/composer/init.lua'
no file './composer.lua'
no file './composer/init.lua'
no file './lua/composer.lua'
no file './lua/composer/init.lua'
no file '/Applications/ZeroBraneStudio.app/Contents/ZeroBraneStudio/lualibs/composer/composer.lua'
no file '/Applications/ZeroBraneStudio.app/Contents/ZeroBraneStudio/lualibs/composer.lua'
no file '/Applications/ZeroBraneStudio.app/Contents/ZeroBraneStudio/lualibs/composer/composer/init.lua'
no file '/Applications/ZeroBraneStudio.app/Contents/ZeroBraneStudio/lualibs/composer/init.lua'
no file './composer.so'
no file '/usr/local/lib/lua/5.1/composer.so'
no file '/usr/local/lib/lua/5.1/loadall.so'
no file '/Applications/ZeroBraneStudio.app/Contents/ZeroBraneStudio/bin/clibs/composer.dylib'
no file '/Applications/ZeroBraneStudio.app/Contents/ZeroBraneStudio/bin/clibs/libcomposer.dylib'
stack traceback:
[C]: in function 'require'
SampleCode/Interface/Composer/main.lua:18: in ma etc.
Please help me to understand what is going wrong!
Thanks
It looks like your project points to /Applications/Corona-3664/ folder, but it needs to point to the location of your project files, such that the require statement for your project modules work from that location (or you need to adjust package.path values so that Lua interpreter can find the modules you are loading).
In this particular case it looks like the application expects the composer.lua to be in the same folder as main.lua, so try setting your project folder to /Applications/Corona-3664/SampleCode/Interface/Composer/ (although it's better to keep it outside of Applications/ folder).

How to get a .exe packaged Ruby Shoes app to reference resources outside the package?

I'm trying to make a standalone .exe packaged Ruby Shoes app that uses images dynamically, meaning whichever images is found in the folder of the .exe file.
Shoes.app() {
background "bg.jpg"
}
This code works if the image is in the same folder when the .exe is packaged, and the image seems to be packaged into the .exe since it's not needed in the same folder as the .exe for it to display when running the exe. But when you want it to load the file in the same folder as the .exe, packaging the app without the image, it does not show. I've tried different ways at finding absolute path to the current directory where the .exe is launched from, but they all seem to point to some temporary directory under AppData and not where the .exe file is located.
Edit: my first answer was incomplete. Windows is a little odd in Shoes for packaged apps. Write a little test script.
Shoes.app do
stack do
para "DIR: #{DIR}"
para "LIB_DIR: #{LIB_DIR}"
cdir = Dir.getwd
para "CWD: #{cdir}"
end
end
Dir.getwd is probably what you want.
Calling pwd should get you what you want
Nope, Ok sorry get it now !:-)
Shoes is opening your exe/shy into AppData/temp so working directory and __FILE__ both point there !
Someone, some time ago proposed this : Trying to access the "current dir" in a packaged Shoes app
must be a better way !
EDIT:
you probably want custom packager (check "i want advanced install options")
check "Expand shy in users directory"
Do as you done for regular packaging.
Now when launching the exe, it will ask you( or the user) to choose where to install your app, proceed, note the directory.
Now before launching the installed app feed the noted directory with your resources and you should be ok
Some references : https://github.com/Shoes3/shoes3/wiki/Custom-Install-Scripts
(there's a lot more to it)
https://github.com/Shoes3/shoes3/issues/247#issuecomment-213919829

Images Disappear in Running Status on Qt

Original design :
Setting in property :
When the program is running :
All the image inside the project folder "QuickRecorder/Images/MainWindow".
How to solve this problem?
Thank you for your help.
In cases like this the reason almost always is: You use relative path to the image, and the working directory is different when you run the application, and image is not found by the relative path.
To debug, add this to your main to print current working directory:
qDebug() << QDir::currentPath();
A few solutions:
Use absolute paths (preferably so that you construct them at runtime, for example using QCoreApplication::applicationDirPath(), instead of hard-coding).
Put images to Qt resources, so they are embedded to the executable.
Change working directory after application starts (might have unintended consequences if you for example launch child processes, or with file open/save dialogs).
Untested, moved from comment to answer: To automatically copy files from the source dir to the build dir, you could add a build step "Custom Process Step" in the Qt Creator project settings. The command you might want to use for the case of this question might be (again, untested):
cp -rv %{sourceDir}/QuickRecorder %{buildDir}

Three.JS plugin for Blender not working

I cannot install the Three.js plugin for Blender. I have a Fedora with Blender 2.69, I created the directory io_mesh_threejs in /usr/share/Blender ... /addon and copied the 3 .py files into but the plugin doesn't appear in the user preference.
I also tried with a downloaded 2.65 version of Blender with no success.
I did it for another library (Babylon.js) and it worked fine so I guess it comes from the python files ?
Here is what I did to get it to work with Win 7 - may work for you also.
Make sure you copy the text from the Raw File format instead of just right clicking and downloading the python files. If you right click and download you might get some additional html code that will break it. Someone else here made that suggestion previously.
Put the import and export files in the io_mesh_threejs folder. Put the init file in the root of the addons directory.
That did the trick for me anyway.
hopefully this adds to the conversation stream ... I've spent two hours finding this answer myself for IFC file imports for Blender ... I've just now got there ... I'm on a Mac with OSX and my Blender 2.71 is positioned in /Users/username/Documents/Blender ... I tried the User Preferences to no avail ... even followed the PATH to /Users/username/Library/Application Support/Blender/2.71/scripts/addons and manually copied the files in using shell ... still nothing ... then I found that the actual place they should go is
/Users/username/Documents/Blender/blender.app/contents/MacOS/2.71/scripts/addons
In my case for IFCBlender I then made a directory called
bash$ mkdir io_scene_ifc
Then I copied in the all the downloaded files ... Hooray this now appeared in my User Preferences ...

Uploading a zip file from relative directory fails on Windows using Selenium WebDriver with Ruby. It works well in Mac

We are currently working on an web application testing using Selenium-Webdriver with Ruby. Originally we only test the OSX platform, until recently we realize that Windows platform should also be tested, (IE, Firefox, Chrome, Opera). But those following lines code that work well on OSX fails on Windows(7 & 8).
I want to upload a zip file from relative directory on Windows, like "./assets/application/www.zip"
#driver.execute_script("arguments[0].style.visibility = 'visible'; arguments[0].style.width = '1px';arguments[0].style.height = '1px';arguments[0].style.opacity = 1",upload_a_zip_btn)
upload_a_zip_btn.send_keys (File.expand_path("../../assets/application/www.zip",__FILE__)) # 1
upload_a_zip_btn.send_keys ("assets\/application\/www.zip") # 2
upload_a_zip_btn.send_keys "C:\\www.zip" # 3
I tried all the 3 conditions, but only the 3rd works.
The error appeared in Browser said some error like "no attached file"
Does anyone know how to deal with such situation? Thanks

Resources