You can get rid of the environment variable using a win32 api call as explained 
here:
http://stackoverflow.com/questions/2647429/c-windows-path-to-the-folder-where-the-executable-is-located
 


     On Thursday, June 18, 2015 4:45 PM, Hotmail (ArbolOne) 
<arbol...@hotmail.ca> wrote:
   

 I found the solution, the answer to my problem is
getenv("ARBOLONE")

Thanks folks

-----Original Message----- 
From: Max S.
Sent: Thursday, June 18, 2015 5:12 PM
To: Hotmail (ArbolOne)
Cc: MinGW-64 Mailinglist ; gcc-help Mailing List
Subject: Re: finding the data file

I'm not a win user, but it looks to me like your problem is that on one
machine the file is located at
D:\\Program Files\\ArbolOne\\Sound\\KimPossible.wav
and on the other at
C:\\Program Files\\ArbolOne\\Sound\\KimPossible.wav

You could solve this problem by using relative path. Your executable is
located at D:\\Program Files\\ArbolOne\\Sounds.exe if launched
appropriately it's working dir would be D:\\Program Files\\ArbolOne\\
(or C:\\...) and could reach the file by opening Sound\\KimPossible.wav

Now, it would probably be better to sense from the working directory
only the drive letter, or possibly even check for existence of each of
the files and choosing what to play accordingly.

On Thu, 2015-06-18 at 16:15 -0400, Hotmail (ArbolOne) wrote:
> This question is exclusively for Win users.
> OK, having said that, I have a desktop and a laptop. In the desktop I use
> MinGW64 and the GCC compier as well as CodeBlock, but on the laptop I use
> VS2015 and VC++. In my desktop I wrote a program that plays a sound file,
> the structure of the file directory is like so:
> D:
> |
> Program Files {parent directory}
> ArbolOne ( folder )
> |__ Sound ( folder )
> |_____Sounds.exe
>
> In my application the code looks like this:
>
> player->Play(L"D:\\Program Files\\ArbolOne\\Sound\\KimPossible.wav");
>
> This works perfect on my desktop, but the directory tree in my laptop 
> looks
> like this
> C:
> |
> Program File {parent directory}
> ArbolOne ( folder )
> |__ Sound ( folder )
> |_____Sounds.exe
>
> You see the problem now, I need to some how create in my program a 
> variable
> that points to ArbolOne, since in both machines have a Global System
> Variable called
> %ARBOLONE%
> which points to the location of the ArbolOne folder.
> Does any one here know how to unravel this problem.
>
> Thanks
>



------------------------------------------------------------------------------
_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


   
------------------------------------------------------------------------------
_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to