resourceDir = new File( resourcesDir, languageDirName );
resourceDir = new File( resourceDir, languageDirName );
	private File[] getResourceDirs(Device device, Locale locale) {		String key = device.getIdentifier();		if (locale != null) {			key += locale.toString();		}		File[] directories = (File[]) this.resourceDirsByDevice.get( key );		if (directories != null) {			return directories;		}		ArrayList dirs = new ArrayList();		for (int j = 0; j < this.resourceDirectories.length; j++) {			File resourcesDir = this.resourceDirectories[j];			// first dir is the general resources dir:			dirs.add( resourcesDir );			//String resourcePath = resourcesDir.getAbsolutePath() + File.separator;			// then the vendor specific resources:			File resourceDir = new File( resourcesDir, device.getVendorName() );			if (resourceDir.exists()) {				dirs.add( resourceDir );			}			// now add all dynamic ScreenSize-directories:			String screenSize = device.getCapability("polish.ScreenSize");			if (screenSize != null) {				for (int i = 0; i < this.dynamicScreenSizeDirs.length; i++ ) {					SizeMatcher matcher = this.dynamicScreenSizeMatchers[i];					if (matcher.matches(screenSize)) {						resourceDir = this.dynamicScreenSizeDirs[i];						dirs.add( resourceDir );					}				}			}			// now add all dynamic CanvasSize-directories:			String canvasSize = device.getCapability("polish.CanvasSize");			if (canvasSize != null) {				for (int i = 0; i < this.dynamicCanvasSizeDirs.length; i++ ) {					SizeMatcher matcher = this.dynamicCanvasSizeMatchers[i];					if (matcher.matches(canvasSize)) {						resourceDir = this.dynamicCanvasSizeDirs[i];						dirs.add( resourceDir );					}				}			}			// now add all dynamic FullCanvasSize-directories:			String fullCanvasSize = device.getCapability("polish.FullCanvasSize");			if (fullCanvasSize != null) {				for (int i = 0; i < this.dynamicFullCanvasSizeDirs.length; i++ ) {					SizeMatcher matcher = this.dynamicFullCanvasSizeMatchers[i];					if (matcher.matches(fullCanvasSize)) {						resourceDir = this.dynamicFullCanvasSizeDirs[i];						dirs.add( resourceDir );					}				}			}			// now add all group resource-directories:			String[] groups = device.getGroupNames();			for (int i = 0; i < groups.length; i++) {				String group = groups[i];				resourceDir = new File( resourcesDir,  group );				if (resourceDir.exists()) {					dirs.add( resourceDir );				}			}			// The last possible resource directory is the directory for the specific device:			resourceDir = new File( resourcesDir, device.getVendorName() 								+ File.separatorChar + device.getName() );			if (resourceDir.exists()) {				dirs.add( resourceDir );			}							if (locale != null) {				// now add all locale-specific directories:				String languageDirName = null;				String localeDirName = locale.toString();				if (locale.getCountry().length() > 0) {					languageDirName = locale.getLanguage();				}				directories = (File[]) dirs.toArray( new File[ dirs.size() ]);				for (int i = 0; i < directories.length; i++) {					resourceDir = directories[i];					//resourcePath = resourceDir.getAbsolutePath() + File.separator;					if (languageDirName != null) {						resourceDir = new File( resourcesDir, languageDirName );						if (resourceDir.exists()) {							dirs.add( resourceDir );						}					}					resourceDir = new File( resourcesDir, localeDirName );					if (resourceDir.exists()) {						dirs.add( resourceDir );					}								}			}					}		directories = (File[]) dirs.toArray( new File[ dirs.size() ]);		this.resourceDirsByDevice.put( key, directories );		return directories;	}