Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 55503a4

Browse files
committed
Fix isRaspberryPi check
1 parent 6153b0c commit 55503a4

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

tools/hxcpp/Setup.hx

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -228,10 +228,16 @@ class Setup
228228

229229
public static function isRaspberryPi()
230230
{
231-
var proc = new Process("uname",["-a"]);
232-
var str = proc.stdout.readLine();
233-
proc.close();
234-
return str.split(" ")[1]=="raspberrypi";
231+
var modelFile = '/sys/firmware/devicetree/base/model';
232+
if( !FileSystem.exists( modelFile ) )
233+
return false;
234+
try {
235+
var model = sys.io.File.getContent( modelFile );
236+
return ~/Raspberry/.match( model );
237+
} catch(e:Dynamic) {
238+
trace( e );
239+
}
240+
return false;
235241
}
236242

237243
static public function startPdbServer()

0 commit comments

Comments
 (0)