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> <20121115210903 DOT 90A4881345E3 AT turkos DOT aspodata DOT se> <20121116135510 DOT 6D56B81345EB AT turkos DOT aspodata DOT se> Date: Fri, 16 Nov 2012 11:40:34 -0500 Message-ID: Subject: Re: [geda-user] Bug #903129 Translations don't work on Windows From: Bob Paddock To: geda-user AT delorie DOT com Content-Type: multipart/alternative; boundary=f46d04389415486a3304ce9f6d30 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 Precedence: bulk --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 #include 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

> It should be better if the lib coul= d have a get_localedir() routine and
> provide it to the caller.
&= gt;
> > > How do other programs handle this?
> >
&g= t; > I usually use the wxWidgets package for my Windows code and it has<= br> > > 'standard paths':
> > http://docs.wxwidgets.org/2.8/wx_wx= standardpaths.html
> > http://docs.wxwidgets.org/2.9.4/classwx_st= andard_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 mo= ves the=A0dependency=A0from one library to the other, did a bit of digging = any came up with this:

This code will tell where the ru= nning .exe is located, it will return a string such
as "C:\gEDA\geda.exe". =A0Find the last '\' and use every= thing before that as the path.
May have to = change '\' to '\\' =A0or '/' depending on the usage= .

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

#include <stdio.h>
#i= nclude <windows.h>

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

=A0 HIN= STANCE instance_h =3D GetModuleHandle(NULL);

=A0 if( =A0GetModuleFil= eName(instance_h, FileName_ca, MAX_PATH) )
=A0 =A0 {
=A0 =A0 =A0 prin= tf( "We are located at: %s\n", FileName_ca );
=A0 =A0 }
=A0 else
=A0 =A0{
=A0 =A0 =A0/* ASSERT or something, as = this should never happen */
=A0 =A0}
}
=A0
--f46d04389415486a3304ce9f6d30--