Browse Source

Fixing a bug in the FS

Panagiotis Christopoulos Charitos 10 years ago
parent
commit
cdf2353c0b
2 changed files with 8 additions and 7 deletions
  1. 7 6
      src/resource/Material.cpp
  2. 1 1
      testapp/Main.cpp

+ 7 - 6
src/resource/Material.cpp

@@ -551,21 +551,22 @@ Error Material::createProgramSourceToCache(
 
 
 	// Create the hash
 	// Create the hash
 	U64 h = computeHash(&source[0], source.getLength());
 	U64 h = computeHash(&source[0], source.getLength());
-	StringAuto prefix(alloc);
 
 
-	prefix.toString(h);
+	// Create out
+	out.sprintf("mtl_%llu.glsl", h);
 
 
 	// Create path
 	// Create path
-	out.sprintf("%s/mtl_%s.glsl",
+	StringAuto fullFname(alloc);
+	fullFname.sprintf("%s/%s",
 		&getManager()._getCacheDirectory()[0],
 		&getManager()._getCacheDirectory()[0],
-		&prefix[0]);
+		&out[0]);
 
 
 	// If file not exists write it
 	// If file not exists write it
-	if(!fileExists(out.toCString()))
+	if(!fileExists(fullFname.toCString()))
 	{
 	{
 		// If not create it
 		// If not create it
 		File f;
 		File f;
-		ANKI_CHECK(f.open(out.toCString(), File::OpenFlag::WRITE));
+		ANKI_CHECK(f.open(fullFname.toCString(), File::OpenFlag::WRITE));
 		ANKI_CHECK(f.writeText("%s\n", &source[0]));
 		ANKI_CHECK(f.writeText("%s\n", &source[0]));
 	}
 	}
 
 

+ 1 - 1
testapp/Main.cpp

@@ -509,7 +509,7 @@ Error initSubsystems(int argc, char* argv[])
 	//config.set("maxTextureSize", 256);
 	//config.set("maxTextureSize", 256);
 	config.set("fullscreenDesktopResolution", false);
 	config.set("fullscreenDesktopResolution", false);
 	config.set("debugContext", false);
 	config.set("debugContext", false);
-	config.set("dataPaths", ".:assets");
+	config.set("dataPaths", "assets");
 
 
 	app = new App;
 	app = new App;
 	err = app->create(config, allocAligned, nullptr);
 	err = app->create(config, allocAligned, nullptr);