Skip to content

Commit 2a909c0

Browse files
committed
RTL/LTR support added
1 parent f214044 commit 2a909c0

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/services/android-project-service.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -255,16 +255,19 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject
255255
public buildProject(projectRoot: string, buildConfig?: IBuildConfig): IFuture<void> {
256256
return (() => {
257257
if (this.canUseGradle().wait()) {
258+
258259
// Validate App_Resources drawable resources accoring to the official docs: https://developer.android.com/guide/topics/resources/providing-resources.html
259260
let drawableFilePrefix = "drawable-";
261+
let drawableRTLPrefix = "ldrtl-";
262+
let drawableLTRPrefix = "ldltr-";
260263
let allowedDrawables = ["ldpi", "mdpi", "hdpi", "xhdpi", "xxhdpi", "xxxhdpi", "nodpi", "tvdpi"];
261264
let appSourceDirectoryPath = path.join(this.$projectData.projectDir, constants.APP_FOLDER_NAME);
262265
let sourceAppResourcesDirectoryPath = path.join(appSourceDirectoryPath, constants.APP_RESOURCES_FOLDER_NAME, this.$devicePlatformsConstants.Android);
263266

264267
if (this.$fs.exists(sourceAppResourcesDirectoryPath).wait()) {
265268
this.$fs.enumerateFilesInDirectorySync(sourceAppResourcesDirectoryPath, (file: string, stat: IFsStats) => {
266-
if (stat.isDirectory() && file.indexOf(drawableFilePrefix) !== -1 &&
267-
allowedDrawables.indexOf(path.basename(file).replace(drawableFilePrefix, "")) === -1) {
269+
if (stat.isDirectory() && (file.indexOf(drawableFilePrefix) !== -1) &&
270+
allowedDrawables.indexOf(path.basename(file).replace(drawableFilePrefix, "").replace(drawableRTLPrefix, "").replace(drawableLTRPrefix, "")) === -1) {
268271
this.$errors.failWithoutHelp(`Invalid Android drawable resource folder detected: ${file}. Please check your ${constants.APP_RESOURCES_FOLDER_NAME} folder.`);
269272
return false;
270273
}

0 commit comments

Comments
 (0)