Skip to content

Commit

Permalink
fix loading prop file from alternate location
Browse files Browse the repository at this point in the history
  • Loading branch information
bananer authored and julianxhokaxhiu committed Feb 2, 2021
1 parent b834b74 commit d4b1151
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Helpers/Build.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,12 @@ public function __construct($fileName, $physicalPath) {
// Try to load the build.prop from two possible paths:
// - builds/CURRENT_ZIP_FILE.zip/system/build.prop
// - builds/CURRENT_ZIP_FILE.zip.prop ( which must exist )
$this->buildProp = explode( "\n", @file_get_contents('zip://'.$this->filePath.'#system/build.prop') ?? @file_get_contents($this->filePath.'.prop') );
$propsFileContent = @file_get_contents('zip://'.$this->filePath.'#system/build.prop');
if ($propsFileContent === false || empty($propsFileContent)) {
$propsFileContent = @file_get_contents($this->filePath.'.prop');
}
$this->buildProp = explode( "\n", $propsFileContent );

// Try to fetch build.prop values. In some cases, we can provide a fallback, in other a null value will be given
$this->timestamp = intval( $this->getBuildPropValue( 'ro.build.date.utc' ) ?? filemtime($this->filePath) );
$this->incremental = $this->getBuildPropValue( 'ro.build.version.incremental' ) ?? '';
Expand Down

0 comments on commit d4b1151

Please sign in to comment.