Skip to content

Commit

Permalink
[Xamarin.Android.Build.Tasks] Fix APT2264 error on Windows. (#8289)
Browse files Browse the repository at this point in the history
We see users reporting the following error on Windows machines.

	APT2000 The system cannot find the file specified. (2): foo.xml

This is odd because what it *should* be reporting an APT2264 error.
This provides additional feedback to check for Long File Paths.  As a
result users do not get the additional info.

It turns out that `aapt2` generates subtly different error messages
between Linux/macOS and Windows, replacing a `.` with `:`.

  * Linux/macOS:

        The system cannot find the file specified. (2).

  * Windows
        
        The system cannot find the file specified. (2):

Because our APT2264-checking code included the trailing `.` and
Windows instead had a trailing `:`, we would *never* return APT2264
on Windows.

Lets fix that by removing the trailing `.` from what we look for.
  • Loading branch information
dellis1972 authored and jonathanpeppers committed Aug 23, 2023
1 parent 3a3bb18 commit c24ca77
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Xamarin.Android.Build.Tasks/Tasks/Aapt2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ static string GetErrorCode (string message)
Tuple.Create ("APT2261", "file failed to compile"),
Tuple.Create ("APT2262", "unexpected element <activity> found in <manifest>"),
Tuple.Create ("APT2263", "found in <manifest>"), // unexpected element <xxxxx> found in <manifest>
Tuple.Create ("APT2264", "The system cannot find the file specified. (2).") // Windows Long Path error from aapt2
Tuple.Create ("APT2264", "The system cannot find the file specified. (2)") // Windows Long Path error from aapt2
};
}
}

0 comments on commit c24ca77

Please sign in to comment.