MCPcopy
hub / github.com/shunsukesaito/PIFu / findFileOrThrow

Function findFileOrThrow

lib/renderer/gl/framework.py:73–90  ·  view source on GitHub ↗
(strBasename)

Source from the content-addressed store, hash-verified

71# Helper function to locate and open the target file (passed in as a string).
72# Returns the full path to the file as a string.
73def findFileOrThrow(strBasename):
74 # Keep constant names in C-style convention, for readability
75 # when comparing to C(/C++) code.
76 if os.path.isfile(strBasename):
77 return strBasename
78
79 LOCAL_FILE_DIR = "data" + os.sep
80 GLOBAL_FILE_DIR = os.path.dirname(os.path.abspath(__file__)) + os.sep + "data" + os.sep
81
82 strFilename = LOCAL_FILE_DIR + strBasename
83 if os.path.isfile(strFilename):
84 return strFilename
85
86 strFilename = GLOBAL_FILE_DIR + strBasename
87 if os.path.isfile(strFilename):
88 return strFilename
89
90 raise IOError('Could not find target file ' + strBasename)

Callers 1

loadShaderFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected