delorie.com/archives/browse.cgi   search  
Mail Archives: geda-user/2012/11/16/11:42:11

X-Authentication-Warning: delorie.com: mail set sender to geda-user-bounces using -f
X-Recipient: geda-user AT delorie DOT com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20120113;
h=mime-version:in-reply-to:references:date:message-id:subject:from:to
:content-type;
bh=InavivGGkwD1aLRlCn/NkC652SwnMH7cF3XZg3u5+co=;
b=IDzXLQjxAfYVU6uYZ/yIIiEDlEQcvsatDVvdgoEjWymVLizFRH5JmsUkjnJn6/Kwku
kdY4kCpB/w1VlYbhOwHdNvBV8u77Dqbhwap9rNbJMFQu+TFOyGfuct2lDYmOi1KmtNGL
n6QV9sb64PQyDnyEEX4dz/qelduets5qx2zhn50BhFTW7LPrL2YtMKYD7iY7CSFcLYcs
3ex2slnxzthE8I1Sjc53BxPZfBcE+z4o89kNc+CmkEOxXwWF0mLxsJy9RlG9VtUQ0QCL
35LlG6txLwqwScSbnNsZuGam50aC6AC7c4qxtMh/D3My6NYG9+y9g6mwD0IeL92foUgt
B5ag==
MIME-Version: 1.0
In-Reply-To: <20121116135510.6D56B81345EB@turkos.aspodata.se>
References: <20121113211401 DOT 20747813A49B AT turkos DOT aspodata DOT se>
<CAOuGh89nhtaPkKZ+0CJGn9V_XnZyi6YD-NndT53FHoAyYD0LFw AT mail DOT gmail DOT com>
<20121115210903 DOT 90A4881345E3 AT turkos DOT aspodata DOT se>
<CAPYb0EE-xqA681-iq9AwnL7Wq1j9NL7AP383X5qe5QeCZZW0Ug AT mail DOT gmail DOT com>
<20121116135510 DOT 6D56B81345EB AT turkos DOT aspodata DOT se>
Date: Fri, 16 Nov 2012 11:40:34 -0500
Message-ID: <CAOuGh8_tCu_CM=RCRPDAoJMObszqWpjG29-37rAUAHyBN18uSw@mail.gmail.com>
Subject: Re: [geda-user] Bug #903129 Translations don't work on Windows
From: Bob Paddock <graceindustries AT gmail DOT com>
To: geda-user AT delorie DOT com
Reply-To: geda-user AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: geda-user AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

--f46d04389415486a3304ce9f6d30
Content-Type: text/plain; charset=ISO-8859-1

> It should be better if the lib could have a get_localedir() routine and
> provide it to the caller.
>
> > > How do other programs handle this?
> >
> > I usually use the wxWidgets package for my Windows code and it has
> > 'standard paths':
> > http://docs.wxwidgets.org/2.8/wx_wxstandardpaths.html
> > http://docs.wxwidgets.org/2.9.4/classwx_standard_paths.html
>
> We cannot depend on that, but I found [1].
>
> [1]
http://developer.gnome.org/glib/2.28/glib-Windows-Compatibility-Functions.html#g-win32-get-package-installation-directory-of-module

That just moves the dependency from one library to the other, did a bit of
digging any came up with this:

This code will tell where the running .exe is located, it will return a
string such
as "C:\gEDA\geda.exe".  Find the last '\' and use everything before that as
the path.
May have to change '\' to '\\'  or '/' depending on the usage.

/*
 * Simple example of how to find the location of running .exe (us).
 *
 * Example does not account for issues of Internalization of file
names/file systems.
 */

#include <stdio.h>
#include <windows.h>

int main( void )
{
  char FileName_ca[MAX_PATH];

  HINSTANCE instance_h = GetModuleHandle(NULL);

  if(  GetModuleFileName(instance_h, FileName_ca, MAX_PATH) )
    {
      printf( "We are located at: %s\n", FileName_ca );
    }
  else
   {
     /* ASSERT or something, as this should never happen */
   }
}

--f46d04389415486a3304ce9f6d30
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<br><div class=3D"gmail_extra"><br>&gt; It should be better if the lib coul=
d have a get_localedir() routine and<br>&gt; provide it to the caller.<br>&=
gt;<br>&gt; &gt; &gt; How do other programs handle this?<br>&gt; &gt;<br>&g=
t; &gt; I usually use the wxWidgets package for my Windows code and it has<=
br>
&gt; &gt; &#39;standard paths&#39;:<br>&gt; &gt; <a href=3D"http://docs.wxw=
idgets.org/2.8/wx_wxstandardpaths.html">http://docs.wxwidgets.org/2.8/wx_wx=
standardpaths.html</a><br>&gt; &gt; <a href=3D"http://docs.wxwidgets.org/2.=
9.4/classwx_standard_paths.html">http://docs.wxwidgets.org/2.9.4/classwx_st=
andard_paths.html</a><br>
&gt;<br>&gt; We cannot depend on that, but I found [1].<br>&gt;<br>&gt; [1]=
 <a href=3D"http://developer.gnome.org/glib/2.28/glib-Windows-Compatibility=
-Functions.html#g-win32-get-package-installation-directory-of-module">http:=
//developer.gnome.org/glib/2.28/glib-Windows-Compatibility-Functions.html#g=
-win32-get-package-installation-directory-of-module</a></div>
<div class=3D"gmail_extra"><br><div class=3D"gmail_quote"><div>That just mo=
ves the=A0dependency=A0from one library to the other, did a bit of digging =
any came up with this:</div><div><br></div>This code will tell where the ru=
nning .exe is located, it will return a string such<br>
as &quot;C:\gEDA\geda.exe&quot;. =A0Find the last &#39;\&#39; and use every=
thing before that as the path.</div><div class=3D"gmail_quote">May have to =
change &#39;\&#39; to &#39;\\&#39; =A0or &#39;/&#39; depending on the usage=
.<br>
<br>/*<br>=A0* Simple example of how to find the location of running .exe (=
us).<br>=A0*<br>=A0* Example does not account for issues of Internalization=
 of file names/file systems.<br>=A0*/<br><br>#include &lt;stdio.h&gt;<br>#i=
nclude &lt;windows.h&gt;<br>
<br>int main( void )<br>{<br>=A0 char FileName_ca[MAX_PATH];<br><br>=A0 HIN=
STANCE instance_h =3D GetModuleHandle(NULL);<br><br>=A0 if( =A0GetModuleFil=
eName(instance_h, FileName_ca, MAX_PATH) )<br>=A0 =A0 {<br>=A0 =A0 =A0 prin=
tf( &quot;We are located at: %s\n&quot;, FileName_ca );<br>
=A0 =A0 }<br>=A0 else<br>=A0 =A0{<br>=A0 =A0 =A0/* ASSERT or something, as =
this should never happen */<br>=A0 =A0}<br>}<br>=A0<br></div></div>

--f46d04389415486a3304ce9f6d30--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019