@@ -290,12 +290,14 @@ def getGraphicsForClass(modelicaClass):
290290 graphicsObj ['href' ] = "data:image;base64," + g [9 ].strip ('"' )
291291 else :
292292 fname = ask_omc ('uriToFilename' , g [8 ], parsed = False ).strip ().strip ('"' )
293+ if not os .path .exists (fname ):
294+ fname = os .path .join (baseDir , g [8 ].strip ('"' ))
293295 if os .path .exists (fname ):
294296 fdata = open (fname , "rb" ).read ()
297+ graphicsObj ['href' ] = "data:image;base64," + base64 .b64encode (fdata )
295298 else :
296- fname = os .path .join (baseDir , g [8 ].strip ('"' ))
297- fdata = open (fname , "rb" ).read ()
298- graphicsObj ['href' ] = "data:image;base64," + base64 .b64encode (fdata )
299+ logger .error ("Could not find bitmap file {0}" .format (g [8 ]))
300+ graphicsObj ['href' ] = g [8 ].strip ('"' )
299301
300302 if not 'type' in graphicsObj :
301303 r = regex_any .search (icon_line )
@@ -1142,11 +1144,11 @@ def generateSvg(filename, iconGraphics, includeInvisibleText, warn_duplicates):
11421144 hashPath = os .path .join (os .path .dirname (filename ),hashName [:1 ],hashName )
11431145 if not os .path .exists (hashPath ):
11441146 dwg .saveas (hashPath )
1145- if not os .path .exists (filename ):
1147+ if not os .path .islink (filename ):
11461148 try :
11471149 os .symlink (hashName , filename )
11481150 except OSError as e :
1149- logger .error (filename + " already exists" )
1151+ logger .error ('Target file {0} already exists' . format ( filename ) )
11501152 else :
11511153 if warn_duplicates :
11521154 logger .warning ('Target file {0} already exists' .format (filename ))
0 commit comments