MCPcopy Create free account
hub / github.com/demoth/jake2 / LoadFile

Method LoadFile

qcommon/src/main/java/jake2/qcommon/filesystem/FS.java:326–348  ·  view source on GitHub ↗
(String path)

Source from the content-addressed store, hash-verified

324 * return the file content as byte[]
325 */
326 public static byte[] LoadFile(String path) {
327 // TODO hack for bad strings (fuck \0)
328 int index = path.indexOf('\0');
329 if (index != -1)
330 path = path.substring(0, index);
331
332 try {
333 QuakeFile file = FOpenFile(path);
334 if (file == null) {
335 file = FOpenFile(path.toLowerCase());
336 if (file != null) {
337 // some mods mess up the case
338 Com.Printf("Found file by lowercase: " + path + "\n");
339 } else {
340 return null;
341 }
342 }
343 return file.toBytes();
344 } catch (IOException e) {
345 Com.Error(Defines.ERR_FATAL, e.toString());
346 return null;
347 }
348 }
349
350 /**
351 * Filename are relative to the quake search path a null buffer will just

Callers 15

Menu_Credits_fMethod · 0.95
StartServer_MenuInitMethod · 0.95
CLClass · 0.95
RequestNextDownloadMethod · 0.95
LoadSoundMethod · 0.95
LoadPCXMethod · 0.95
LoadTGAMethod · 0.95
GL_LoadWalMethod · 0.95
GL_InitImagesMethod · 0.95
Mod_ForNameMethod · 0.95
SV_BeginDownload_fMethod · 0.95
SV_MAINMethod · 0.95

Calls 5

FOpenFileMethod · 0.95
PrintfMethod · 0.95
toBytesMethod · 0.95
ErrorMethod · 0.95
toStringMethod · 0.45

Tested by

no test coverage detected