1. WEE under Wine

The Run menu F5 hotkey options haven't worked for me while running wee under Wine on Ubuntu. So I copied some code from ed.ex into the run_start procedure in the file ui_win.e and it seems to work just fine now. I'm sure there is a better way to do this - can euphoria detect Wine?

--  mods to enable WEE's Run/F5 options to execute current file  
--  file ui_win.e 
include std/text.e  -- for lower 
procedure run_start() 
    -- atom result  -- not needed under wine 
 
    -- save, no confirm 
    if save_if_modified(0) = 0 or length(file_name) = 0 then 
      return -- cancelled, or no name 
    end if 
 
    run_file_name = file_name 
 
    ifdef UNIX then system 
            system("eui \"" & file_name & "\"") 
     elsedef 
            if match(".exw", lower(file_name)) or 
                  match(".ew",  lower(file_name)) then 
                system("euiw \"" & file_name & "\"") 
            else 
                system("eui \"" & file_name & "\"") 
            end if 
    end ifdef 
 
--    result = c_func(ShellExecute, { 
--  hMainWnd, NULL, 
--  alloc_string(run_file_name), 
--  NULL, 
--  NULL, 
--  1}) 
--    free_strings() 
 
end procedure 
 
new topic     » topic index » view message » categorize

2. Re: WEE under Wine

K_D_R said...

can euphoria detect Wine?

DeveloperFaq said...

How can I detect Wine?

This is a bad idea. The goal of Wine is that an application will see no difference running under Wine rather than Windows. So any method to detect running under Wine is unsupported and may break without warning in the future.

Wine should not be treated as a "version" of Windows - functionality or performance-tuning is likely to be different between any two development versions.

Rather than detecting Wine:

  • Detect if functionality exists and use it when available.
  • File a bug if something works in Windows that does not work in Wine.
    • If you can write a minimal test that demonstrates the bug, even better!
  • Ask for help on the developers' list.

That said: There is nothing wrong with detecting Wine for survey purposes. Many developers are surprised to learn that a substantial portion of their userbase has been running their program via Wine; sometimes developers aren't even aware that this is possible.

If you still really want to detect Wine, check whether ntdll exports the function wine_get_version. (See http://www.winehq.org/pipermail/wine-devel/2008-September/069387.html )

-Greg

new topic     » goto parent     » topic index » view message » categorize

3. Re: WEE under Wine

Here is an example based on the code in that link. I have not properly tested because I do not have Wine installed. On Windows I get "did not detect Wine" as expected.

include std/dll.e 
include std/machine.e 
 
public function wine_get_version() 
     
    object version = 0 
     
ifdef WINDOWS then 
     
    atom ntdll = open_dll( "ntdll.dll" ) 
    integer _wine_get_version = define_c_func( ntdll, "+wine_get_version", {}, C_POINTER ) 
     
    if _wine_get_version != -1 then 
         
        atom pversion = c_func( _wine_get_version, {} ) 
        version = peek_string( pversion ) 
         
    end if 
     
end ifdef 
     
    return version 
end function 
 
object version = wine_get_version() 
 
if sequence( version ) then 
    printf( 1, "running on Wine %s\n", {version} ) 
else 
    puts( 1, "did not detect Wine\n" ) 
end if 

-Greg

new topic     » goto parent     » topic index » view message » categorize

4. Re: WEE under Wine

K_D_R said...

The Run menu F5 hotkey options haven't worked for me while running wee under Wine on Ubuntu. So I copied some code from ed.ex into the run_start procedure in the file ui_win.e and it seems to work just fine now. I'm sure there is a better way to do this - can euphoria detect Wine?

I tried it just now and F5 works just fine in Wine. Maybe you don't have the .ex/.exw file associations required for the shellexecute to work? Did you install Euphoria in wine through the .exe or the .zip?

I also agree with what Greg pointed out, I'd rather not have to detect wine. Maybe I can check the result of the shellexecute and use system as a fallback.

Edit: Also, if you're trying to run console programs from WEE, you should use wineconsole instead of wine.

new topic     » goto parent     » topic index » view message » categorize

5. Re: WEE under Wine

With the regular run_start code using ShellExecute a "Wine Explorer" file browser windows opens up.

I have no idea how or where to set my ShellExecute association.

Thanks for all the other info.

I look forward to a ui_gtk version for Linux.

Regards, Ken

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu