Revert packager randomization revert

This commit is contained in:
Justin Spahr-Summers
2015-09-25 09:21:44 -07:00
committed by facebook-github-bot-7
parent 23564fe65a
commit 1487ebfe01
3 changed files with 42 additions and 12 deletions

View File

@@ -252,6 +252,11 @@ class ResolutionRequest {
_loadAsFile(potentialModulePath) {
return Promise.resolve().then(() => {
if (this._helpers.isAssetFile(potentialModulePath)) {
const dirname = path.dirname(potentialModulePath);
if (!this._fastfs.dirExists(dirname)) {
throw new UnableToResolveError(`Directory ${dirname} doesn't exist`);
}
const {name, type} = getAssetDataFromName(potentialModulePath);
let pattern = '^' + name + '(@[\\d\\.]+x)?';
@@ -263,7 +268,7 @@ class ResolutionRequest {
// We arbitrarly grab the first one, because scale selection
// will happen somewhere
const [assetFile] = this._fastfs.matches(
path.dirname(potentialModulePath),
dirname,
new RegExp(pattern)
);