Skip to content

Commit 0582ce4

Browse files
Simplify runtime config parsing by removing manual file existence check
Co-authored-by: davidnguyen-tech <87228593+davidnguyen-tech@users.noreply.github.com>
1 parent 410ea94 commit 0582ce4

File tree

1 file changed

+12
-19
lines changed

1 file changed

+12
-19
lines changed

src/tasks/AndroidAppBuilder/ApkBuilder.cs

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -715,32 +715,25 @@ private Dictionary<string, string> ParseRuntimeConfigProperties()
715715

716716
try
717717
{
718-
if (File.Exists(runtimeConfigPath))
718+
byte[] fileBytes = File.ReadAllBytes(runtimeConfigPath);
719+
unsafe
719720
{
720-
byte[] fileBytes = File.ReadAllBytes(runtimeConfigPath);
721-
unsafe
721+
fixed (byte* ptr = fileBytes)
722722
{
723-
fixed (byte* ptr = fileBytes)
724-
{
725-
var blobReader = new BlobReader(ptr, fileBytes.Length);
723+
var blobReader = new BlobReader(ptr, fileBytes.Length);
726724

727-
// Read the compressed integer count
728-
int count = blobReader.ReadCompressedInteger();
725+
// Read the compressed integer count
726+
int count = blobReader.ReadCompressedInteger();
729727

730-
// Read each key-value pair
731-
for (int i = 0; i < count; i++)
732-
{
733-
string key = blobReader.ReadSerializedString() ?? string.Empty;
734-
string value = blobReader.ReadSerializedString() ?? string.Empty;
735-
configProperties[key] = value;
736-
}
728+
// Read each key-value pair
729+
for (int i = 0; i < count; i++)
730+
{
731+
string key = blobReader.ReadSerializedString() ?? string.Empty;
732+
string value = blobReader.ReadSerializedString() ?? string.Empty;
733+
configProperties[key] = value;
737734
}
738735
}
739736
}
740-
else
741-
{
742-
logger.LogMessage(MessageImportance.Normal, $"Runtime config file not found at {runtimeConfigPath}");
743-
}
744737
}
745738
catch (Exception ex)
746739
{

0 commit comments

Comments
 (0)