Page 1 of 1

possible to check if the x86 programs folder exists?

Posted: Fri Nov 29, 2013 7:32 am
by jjmafiae
is it possible to check if the x86 programs folder exists on windows?

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

Posted: Fri Nov 29, 2013 8:08 am
by Plu
If you use Lua's own io it should be possible, but I don't think love's filesystem can reach there.

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

Posted: Fri Nov 29, 2013 8:35 am
by jjmafiae
oki, thanks comrade.

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

Posted: Fri Nov 29, 2013 9:34 am
by Roland_Yonaba
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())

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

Posted: Sat Nov 30, 2013 3:01 pm
by Boolsheet
There's also the environment variable ProgramFiles(x86) that points to this directory if it's a 64-bit Windows.