--- corec/corec/helpers/file/file_bctbx.c.orig	2022-11-29 10:25:07 UTC
+++ corec/corec/helpers/file/file_bctbx.c
@@ -48,7 +48,7 @@
 // Do not move. Define TARGET_*.
 #include "file.h"
 
-#if defined(TARGET_OSX)
+#if defined(TARGET_OSX) || defined(__FreeBSD__)
 #include <sys/mount.h>
 #elif defined(TARGET_QNX)
 #include <sys/statvfs.h>
@@ -261,157 +261,3 @@ static void Delete(filestream* p)
 	if (p->FindDir)
 		closedir(p->FindDir);
 }
-
-META_START(File_Class,FILE_CLASS)
-META_CLASS(SIZE,sizeof(filestream))
-META_CLASS(PRIORITY,PRI_MINIMUM)
-META_CLASS(DELETE,Delete)
-META_VMT(TYPE_FUNC,stream_vmt,Open,Open)
-META_VMT(TYPE_FUNC,stream_vmt,Read,Read)
-META_VMT(TYPE_FUNC,stream_vmt,ReadBlock,ReadBlock)
-META_VMT(TYPE_FUNC,stream_vmt,Write,Write)
-META_VMT(TYPE_FUNC,stream_vmt,Seek,Seek)
-META_VMT(TYPE_FUNC,stream_vmt,OpenDir,OpenDir)
-META_VMT(TYPE_FUNC,stream_vmt,EnumDir,EnumDir)
-META_CONST(TYPE_INT,filestream,fp,NULL)
-META_DATA_RDONLY(TYPE_INT,STREAM_FLAGS,filestream,Flags)
-META_DATA_RDONLY(TYPE_STRING,STREAM_URL,filestream,URL)
-META_DATA_RDONLY(TYPE_STRING,STREAM_ENUM_BASE,filestream,DirPath)
-META_PARAM(SET,STREAM_LENGTH,SetLength)
-META_DATA(TYPE_FILEPOS,STREAM_LENGTH,filestream,Length)
-META_PARAM(STRING,NODE_PROTOCOL,T("file"))
-META_END(STREAM_CLASS)
-
-bool_t FileExists(nodecontext *p,const tchar_t* Path)
-{
-	struct stat file_stats;
-	return stat(Path, &file_stats) == 0;
-}
-
-bool_t FileErase(nodecontext *p,const tchar_t* Path, bool_t Force, bool_t Safe)
-{
-	if (Force)
-	{
-		struct stat file_stats;
-		if (stat(Path, &file_stats) == 0)
-		{
-			if ((file_stats.st_mode & S_IWUSR)==0)
-			{
-				file_stats.st_mode |= S_IWUSR;
-				chmod(Path,file_stats.st_mode);
-			}
-		}
-	}
-	return unlink(Path) == 0;
-}
-
-bool_t FolderErase(nodecontext *p,const tchar_t* Path, bool_t Force, bool_t Safe)
-{
-	if (Force)
-	{
-		struct stat file_stats;
-		if (stat(Path, &file_stats) == 0)
-		{
-			if ((file_stats.st_mode & S_IWUSR)==0)
-			{
-				file_stats.st_mode |= S_IWUSR;
-				chmod(Path,file_stats.st_mode);
-			}
-		}
-	}
-	return rmdir(Path) == 0;
-}
-
-bool_t PathIsFolder(nodecontext *p,const tchar_t* Path)
-{
-	struct stat file_stats;
-	if (stat(Path, &file_stats) == 0)
-	{
-		return (file_stats.st_mode & S_IFDIR) == S_IFDIR;
-	}
-	return 0;
-}
-
-datetime_t FileDateTime(nodecontext *p,const tchar_t* Path)
-{
-	datetime_t Date = INVALID_DATETIME_T;
-	struct stat file_stats;
-	if (stat(Path, &file_stats) == 0)
-		Date = LinuxToDateTime(file_stats.st_mtime);
-	return Date;
-}
-
-bool_t FileMove(nodecontext *p,const tchar_t* In,const tchar_t* Out)
-{
-	return rename(In,Out) == 0;
-}
-
-bool_t FolderCreate(nodecontext *p,const tchar_t* Path)
-{
-	return mkdir(Path,_RW_ACCESS_DIR) == 0;
-}
-
-void FindFiles(nodecontext *p,const tchar_t* Path, const tchar_t* Mask,void(*Process)(const tchar_t*,void*),void* Param)
-{
-	DIR* Directory;
-	struct dirent* DirectoryInfo;
-	tchar_t TPathToFile[MAXPATH];
-
-	Directory = opendir(Path);
-	if (Directory)
-	{
-		while ( (DirectoryInfo = readdir(Directory)) != NULL )
-		{
-			char* FileExtension = 0;
-			FileExtension = strrchr(DirectoryInfo->d_name, '.');
-			if(FileExtension)
-			{
-				if (strcmp(Mask, FileExtension ) == 0 )
-				{
-					tcscpy_s(TPathToFile, TSIZEOF(TPathToFile), Path);
-					tcscat_s(TPathToFile, TSIZEOF(TPathToFile), DirectoryInfo->d_name);
-					Process(TPathToFile, Param);
-				}
-			}
-		}
-
-		closedir(Directory);
-	}
-
-}
-
-stream *FileTemp(anynode *Any)
-{
-#ifndef TODO
-	assert(NULL); // not supported yet
-#endif
-	return NULL;
-}
-
-bool_t FileTempName(anynode *Any,tchar_t *Out, size_t OutLen)
-{
-#ifndef TODO
-	assert(NULL); // not supported yet
-#endif
-	return 0;
-}
-
-int64_t GetPathFreeSpace(nodecontext* UNUSED_PARAM(p), const tchar_t* Path)
-{
-#ifndef TODO
-	// need to an include (see at includes)
-#if defined(TARGET_QNX)
-	struct statvfs st;
-	if (statvfs(Path, &st) < 0)
-#else
-	struct statfs st;
-	if (statfs(Path, &st) < 0)
-#endif
-		return -1;
-	return (int64_t)st.f_bsize * (int64_t)st.f_bavail;
-#else
-	return -1;
-#endif
-}
-
-
