1 diff -ur collada2gltf.org/GLTF/GLTFAsset.cpp collada2gltf/GLTF/GLTFAsset.cpp
2 --- collada2gltf.org/GLTF/GLTFAsset.cpp 2014-05-23 19:19:39.505246750 +0200
3 +++ collada2gltf/GLTF/GLTFAsset.cpp 2014-05-23 19:20:05.005245669 +0200
5 shared_ptr<GLTFOutputStream> GLTFAsset::createOutputStreamIfNeeded(const std::string& streamName) {
7 if (this->_nameToOutputStream.count(streamName) == 0) {
8 - COLLADABU::URI inputURI(this->getInputFilePath().c_str());
9 COLLADABU::URI outputURI(this->getOutputFilePath().c_str());
11 - std::string folder = outputURI.getPathDir();
12 - std::string fileName = inputURI.getPathFileBase();
14 + std::string folder = COLLADABU::URI(outputURI.getPathDir()).toNativePath();
15 shared_ptr<GLTFOutputStream> outputStream = shared_ptr <GLTFOutputStream> (new GLTFOutputStream(folder, streamName, ""));
16 this->_nameToOutputStream[streamName] = outputStream;
19 this->_bundleOutputPath = outputBundlePathURI.toNativePath();
21 COLLADABU::URI outputPathURI(outputBundlePathURI.getURIString() + "/" + outputBundlePathURI.getPathFileBase() + "." + "json");
22 - this->_outputFilePath = outputPathURI.toNativePath();
23 + this->_outputFilePath = outputPathURI.getURIString();
24 // this->log("outputBundlePath:%s\n",outputBundlePathURI.toNativePath().c_str());
25 // this->log("outputPath:%s\n",outputPathURI.toNativePath().c_str());
27 this->_bundleOutputPath = outputBundlePathURI.toNativePath();
28 COLLADABU::URI outputPathURI(outputBundlePathURI.getURIString() + "/" + outputBundlePathURI.getPathFileBase() + "." + "json");
29 - this->_outputFilePath = outputPathURI.toNativePath();
30 + this->_outputFilePath = outputPathURI.getURIString();
32 COLLADABU::Utils::createDirectoryIfNeeded(this->_bundleOutputPath.c_str());
35 COLLADABU::URI outputImagePathURI(inputImagePath.c_str());
37 COLLADABU::URI outputURI(this->getOutputFilePath().c_str());
38 - std::string folder = outputURI.getPathDir();
39 + std::string folder = COLLADABU::URI(outputURI.getPathDir()).toNativePath();
40 std::string outputPath = folder + outputImagePathURI.getPathFile();
42 - std::ifstream f1(inputImagePath.c_str(), std::fstream::binary);
44 + std::ifstream f1(COLLADABU::URI(inputImagePath).toNativePath().c_str(), std::fstream::binary);
45 std::ofstream f2(outputPath.c_str(), std::fstream::binary);
47 if (this->_converterConfig->boolForKeyPath("verboseLogging")) {
49 this->_root = shared_ptr <GLTF::JSONObject> (new GLTF::JSONObject());
50 this->_root->createObjectIfNeeded(kNodes);
52 - this->_writer.initWithPath(this->getOutputFilePath().c_str());
53 + COLLADABU::URI outputURI(this->getOutputFilePath().c_str());
54 + this->_writer.initWithPath(outputURI.toNativePath().c_str());
57 static void __eval(JSONValue* value, void *context) {
59 void GLTFAsset::_writeJSONResource(const std::string &path, shared_ptr<JSONObject> obj) {
60 GLTF::GLTFWriter resultsWriter;
61 COLLADABU::URI outputURI(this->resourceOuputPathForPath(path));
62 - std::string aPath = this->getOutputFolderPath() + outputURI.getPathFile();
63 + std::string aPath = COLLADABU::URI(this->getOutputFolderPath() + outputURI.getPathFile()).toNativePath();
64 resultsWriter.initWithPath(aPath);
65 obj->write(&resultsWriter);
67 diff -ur collada2gltf.org/shaders/commonProfileShaders.cpp collada2gltf/shaders/commonProfileShaders.cpp
68 --- collada2gltf.org/shaders/commonProfileShaders.cpp 2014-05-23 19:19:39.521246749 +0200
69 +++ collada2gltf/shaders/commonProfileShaders.cpp 2014-05-23 19:20:09.085245497 +0200
71 //also write the file on disk
72 if (shaderString.size() > 0) {
73 COLLADABU::URI outputURI(asset->getOutputFilePath());
74 - std::string shaderPath = outputURI.getPathDir() + path;
75 + std::string shaderPath = COLLADABU::URI(outputURI.getPathDir()).toNativePath() + path;
76 GLTF::GLTFUtils::writeData(shaderPath, "w",(unsigned char*)shaderString.c_str(), shaderString.size());
77 if (!CONFIG_BOOL(asset, "outputProgress") && asset->converterConfig()->boolForKeyPath("verboseLogging")) {
78 asset->log("[shader]: %s\n", shaderPath.c_str());