X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fbuilder%2Fbuilder-filesystem.h;h=947f8ced224836a8e69a6c7b5bfd8f4ebe596bdc;hb=124aa28a0cd62b61142779066432cd29195c42ce;hp=bbb77d7aeec210b1c4dcd463b6712d1fb1537b2f;hpb=57869973578f6a0b0f836d396c7232ddb8302c6b;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/internal/builder/builder-filesystem.h b/dali-toolkit/internal/builder/builder-filesystem.h old mode 100644 new mode 100755 index bbb77d7..947f8ce --- a/dali-toolkit/internal/builder/builder-filesystem.h +++ b/dali-toolkit/internal/builder/builder-filesystem.h @@ -1,8 +1,8 @@ -#ifndef __DALI_TOOLKIT_INTERNAL_BUILDER_FILESYSTEM_H__ -#define __DALI_TOOLKIT_INTERNAL_BUILDER_FILESYSTEM_H__ +#ifndef DALI_TOOLKIT_INTERNAL_BUILDER_FILESYSTEM_H +#define DALI_TOOLKIT_INTERNAL_BUILDER_FILESYSTEM_H /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2019 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,6 +27,8 @@ #include #include +#include + inline std::string ExpandPath(const std::string &name) { wordexp_t p; @@ -46,14 +48,22 @@ inline std::string ExpandPath(const std::string &name) inline std::string ExePath(void) { char buf[256]; - readlink("/proc/self/exe", buf, sizeof(buf)); + ssize_t len = readlink("/proc/self/exe", buf, sizeof(buf) - 1); + len = len > 0 ? len : 0; + buf[len] = '\0'; return std::string(buf); } inline std::string GetFileContents(const std::string &fn) { - std::ifstream t(fn.c_str()); - return std::string((std::istreambuf_iterator(t)), std::istreambuf_iterator()); + std::streampos bufferSize = 0; + Dali::Vector fileBuffer; + if( !Dali::FileLoader::ReadFile( fn, bufferSize, fileBuffer, Dali::FileLoader::FileType::BINARY ) ) + { + return std::string(); + } + + return std::string( &fileBuffer[0], bufferSize ); } -#endif // __DALI_TOOLKIT_INTERNAL_BUILDER_FILESYSTEM_H__ +#endif // DALI_TOOLKIT_INTERNAL_BUILDER_FILESYSTEM_H