Skip to content

Commit

Permalink
Remove first character on referenced Aspect Model filename
Browse files Browse the repository at this point in the history
  • Loading branch information
michelu89 committed Apr 8, 2024
1 parent 6ec8af8 commit f0ab159
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
9 changes: 1 addition & 8 deletions core/libs/editor/src/lib/editor.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ export class EditorService {

loadExternalAspectModel(extRefAbsoluteAspectModelFileName: string): CachedFile {
const extRdfModel = this.rdfService.externalRdfModels.find(
extRef => this.removeStartingCharacter(extRef.absoluteAspectModelFileName,'/') === extRefAbsoluteAspectModelFileName,
extRef => extRef.absoluteAspectModelFileName === extRefAbsoluteAspectModelFileName,
);
const fileName = extRdfModel.aspectModelFileName;
let foundCachedFile = this.namespaceCacheService.getFile([extRdfModel.getAspectModelUrn(), fileName]);
Expand All @@ -285,13 +285,6 @@ export class EditorService {
return foundCachedFile;
}

removeStartingCharacter(value: string, character: string): string {
if (value.charAt(0) === character) {
return value.substring(1);
}
return value;
}

loadExternalModels(): Observable<Array<RdfModel>> {
this.rdfService.externalRdfModels = [];
return this.modelApiService.getAllNamespacesFilesContent().pipe(
Expand Down
5 changes: 3 additions & 2 deletions core/libs/rdf/src/lib/services/rdf.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,12 +165,13 @@ export class RdfService {
return subject;
}

parseFileName(fileName: string, urn: string): string {
private parseFileName(fileName: string, urn: string): string {
if (this.browserService.isStartedAsElectronApp()) {
const path = window.require('path');
fileName = fileName.includes(path.sep) ? `${urn.replace('#', ':')}${path.basename(fileName)}` : fileName;
}
return fileName;

return fileName.charAt(0) === '/' ? fileName.substring(1) : fileName;
}

parseModels(fileContentModels: FileContentModel[]): Observable<RdfModel[]> {
Expand Down

0 comments on commit f0ab159

Please sign in to comment.