2 * Copyright (c) 2018 Samsung Electronics Co., Ltd.
\r
4 * Licensed under the Apache License, Version 2.0 (the "License");
\r
5 * you may not use this file except in compliance with the License.
\r
6 * You may obtain a copy of the License at
\r
8 * http://www.apache.org/licenses/LICENSE-2.0
\r
10 * Unless required by applicable law or agreed to in writing, software
\r
11 * distributed under the License is distributed on an "AS IS" BASIS,
\r
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
13 * See the License for the specific language governing permissions and
\r
14 * limitations under the License.
\r
19 #include <dali/integration-api/debug.h>
\r
20 #include <dali/public-api/common/dali-vector.h>
\r
21 #include <dali/internal/system/common/file-closer.h>
\r
24 #include <CustomFile.h>
\r
36 namespace InternalFile
\r
39 std::string GetRealName( const char *name )
\r
41 if( NULL != name && '*' == name[0] )
\r
43 std::string envName;
\r
45 const char *p = name + 1;
\r
47 while( 0 != *p && '*' != *p )
\r
49 envName.push_back( *p );
\r
55 char *envValue = std::getenv( envName.c_str() );
\r
57 std::string realName = envValue;
\r
68 FILE *FOpen( const char *name, const char *mode )
\r
70 if( NULL != name && '*' == name[0] )
\r
72 std::string realName = GetRealName( name );
\r
73 return (FILE*)CustomFile::FOpen( realName.c_str(), mode );
\r
77 return (FILE*)CustomFile::FOpen( name, mode );
\r
81 FILE *FMemopen( void *__s, size_t __len, const char *__modes )
\r
83 FILE *ret = (FILE*)CustomFile::FMemopen( __s, __len, __modes );
\r
87 size_t FRead( void* _Buffer, size_t _ElementSize, size_t _ElementCount, FILE* _Stream )
\r
89 return CustomFile::FRead( _Buffer, _ElementSize, _ElementCount, _Stream );
\r
92 int FClose( FILE *__stream )
\r
94 return CustomFile::FClose( __stream );
\r
97 void FWrite( void *buf, int size, int count, FILE *fp )
\r
99 CustomFile::FWrite( buf, size * count, fp );
\r
102 int FSeek( FILE *fp, int offset, int origin )
\r
104 return CustomFile::FSeek( fp, offset, origin );
\r
107 int FTell( FILE *fp )
\r
109 return CustomFile::FTell( fp );
\r
112 bool FEof( FILE *fp )
\r
114 return CustomFile::FEof( fp );
\r