File tree Expand file tree Collapse file tree
native/cocos/platform/openharmony Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -178,6 +178,11 @@ long FileUtilsOpenHarmony::getFileSize(const std::string &filepath) {
178178 if (fullPath.empty ()) {
179179 return 0 ;
180180 }
181+
182+ if (fullPath[0 ] == ' /' ) {
183+ return FileUtils::getFileSize (fullPath);
184+ }
185+
181186 if (nullptr == _nativeResourceManager) {
182187 CC_LOG_ERROR (" nativeResourceManager is nullptr" );
183188 return 0 ;
@@ -201,11 +206,11 @@ bool FileUtilsOpenHarmony::isFileExistInternal(const std::string &strFilePath) c
201206 return false ;
202207 }
203208
204- if (strFilePath[0 ] != ' /' ) {
209+ if (strFilePath[0 ] != ' /' ) {
205210 const char *s = strFilePath.c_str ();
206211 // Found "@assets/" at the beginning of the path and we don't want it
207212 if (strFilePath.find (ASSETS_FOLDER_NAME ) == 0 ) s += strlen (ASSETS_FOLDER_NAME );
208-
213+
209214 if (nullptr == _nativeResourceManager) {
210215 CC_LOG_ERROR (" nativeResourceManager is nullptr" );
211216 return false ;
@@ -217,7 +222,7 @@ bool FileUtilsOpenHarmony::isFileExistInternal(const std::string &strFilePath) c
217222 return true ;
218223 }
219224 return false ;
220- }
225+ }
221226 FILE *fp = fopen (strFilePath.c_str (), " r" );
222227 if (fp) {
223228 fclose (fp);
You can’t perform that action at this time.
0 commit comments