possible to check if the x86 programs folder exists?

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
jjmafiae
Party member
Posts: 1331
Joined: Tue Jul 24, 2012 8:22 am

possible to check if the x86 programs folder exists?

Post by jjmafiae » Fri Nov 29, 2013 7:32 am

is it possible to check if the x86 programs folder exists on windows?

User avatar
Plu
Inner party member
Posts: 722
Joined: Fri Mar 15, 2013 9:36 pm

Re: possible to check if the x86 programs folder exists?

Post by Plu » Fri Nov 29, 2013 8:08 am

If you use Lua's own io it should be possible, but I don't think love's filesystem can reach there.

jjmafiae
Party member
Posts: 1331
Joined: Tue Jul 24, 2012 8:22 am

Re: possible to check if the x86 programs folder exists?

Post by jjmafiae » Fri Nov 29, 2013 8:35 am

oki, thanks comrade.

User avatar
Roland_Yonaba
Inner party member
Posts: 1563
Joined: Tue Jun 21, 2011 6:08 pm
Location: Ouagadougou (Burkina Faso)
Contact:

Re: possible to check if the x86 programs folder exists?

Post by Roland_Yonaba » Fri Nov 29, 2013 9:34 am

Well, why not checking the env variable PATH ?

Code: Select all

local function is_windows()
  return (package.config:sub(1,1) == '\\')
end

local function has_pfx86()
  return is_windows()
	and (os.getenv('PATH'):match('Program Files %(x86%)')~=nil)
end

print('Does the folder Program Files (x86) exist ?', has_pfx86())

User avatar
Boolsheet
Inner party member
Posts: 780
Joined: Wed Dec 29, 2010 4:57 am
Location: Switzerland

Re: possible to check if the x86 programs folder exists?

Post by Boolsheet » Sat Nov 30, 2013 3:01 pm

There's also the environment variable ProgramFiles(x86) that points to this directory if it's a 64-bit Windows.
Shallow indentations.

Post Reply

Who is online

Users browsing this forum: randomnovice and 19 guests