Changeset 47e498b in sasmodels


Ignore:
Timestamp:
May 4, 2016 8:24:26 PM (9 years ago)
Author:
Paul Kienzle <pkienzle@…>
Branches:
master, core_shell_microgels, costrafo411, magnetic_model, release_v0.94, release_v0.95, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
Children:
3a45c2c, c4c426b
Parents:
3832f27
Message:

properly escape backslashes in windows paths when setting compiler #line directives

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/generate.py

    r3832f27 r47e498b  
    464464              for f in model_sources(model_info) 
    465465              # Add #line directives at the start of each file 
    466               for p in ('#line 0 "%s"'%f, open(f).read()) 
     466              for p in ('#line 0 "%s"'%f.replace('\\', '\\\\'), open(f).read()) 
    467467              ] 
    468     source.append('#line 133 "%s"'%C_KERNEL_TEMPLATE_PATH) 
     468    source.append('#line 133 "%s"'%C_KERNEL_TEMPLATE_PATH.replace('\\', '\\\\')) 
    469469 
    470470    # Prepare defines 
     
    508508} 
    509509""" % {'body':model_info['form_volume'], 
    510        'file':model_info['filename'], 
     510       'file':model_info['filename'].replace('\\', '\\\\'), 
    511511       'line':model_info['form_volume_line'], 
    512512       } 
     
    541541} 
    542542""" % {'body':model_info['Iq'], 
    543        'file':model_info['filename'], 
     543       'file':model_info['filename'].replace('\\', '\\\\'), 
    544544       'line':model_info['Iq_line'], 
    545545       } 
     
    574574} 
    575575""" % {'body':model_info['Iqxy'], 
    576        'file':model_info['filename'], 
     576       'file':model_info['filename'].replace('\\', '\\\\'), 
    577577       'line':model_info['Iqxy_line'], 
    578578       } 
Note: See TracChangeset for help on using the changeset viewer.