do not assume module names have three parts

This commit is contained in:
nightwing 2012-07-11 16:50:07 +04:00
commit 445767a598
2 changed files with 5 additions and 5 deletions

View file

@ -395,7 +395,7 @@ function buildAce(options) {
'ace/lib/fixoldbrowsers',
'ace/lib/event_emitter',
'ace/lib/oop',
'ace/worker/' + mode
'ace/mode/' + mode + '_worker'
]
}],
filter: filters,

View file

@ -77,11 +77,11 @@ exports.moduleUrl = function(name, component) {
return options.$moduleUrls[name];
var parts = name.split("/");
component = component || parts[1];
var base = parts[2].replace(component, "").replace(/(^[\-_])|([\-_]$)/, "");
component = component || parts[parts.length - 2] || "";
var base = parts[parts.length - 1].replace(component, "").replace(/(^[\-_])|([\-_]$)/, "");
if (!base)
base = parts[1];
if (!base && parts.length > 1)
base = parts[parts.length - 2];
return this.get(component + "Path") + "/" + component + "-" + base + this.get("suffix");
};