Port to Visual Studio 2015
This commit is contained in:
6
.gitignore
vendored
6
.gitignore
vendored
@@ -2,3 +2,9 @@
|
||||
*.exe
|
||||
build
|
||||
|
||||
*/.vs/*
|
||||
*.opensdf
|
||||
*.sdf
|
||||
VisualStudio/filesync/Debug
|
||||
*.user
|
||||
VisualStudio/Debug/*
|
||||
|
||||
28
VisualStudio/filesync.sln
Normal file
28
VisualStudio/filesync.sln
Normal file
@@ -0,0 +1,28 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 14
|
||||
VisualStudioVersion = 14.0.23107.0
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "filesync", "filesync\filesync.vcxproj", "{D10AC12A-263E-479F-A478-FD8F4067F6F3}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x64 = Debug|x64
|
||||
Debug|x86 = Debug|x86
|
||||
Release|x64 = Release|x64
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{D10AC12A-263E-479F-A478-FD8F4067F6F3}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{D10AC12A-263E-479F-A478-FD8F4067F6F3}.Debug|x64.Build.0 = Debug|x64
|
||||
{D10AC12A-263E-479F-A478-FD8F4067F6F3}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{D10AC12A-263E-479F-A478-FD8F4067F6F3}.Debug|x86.Build.0 = Debug|Win32
|
||||
{D10AC12A-263E-479F-A478-FD8F4067F6F3}.Release|x64.ActiveCfg = Release|x64
|
||||
{D10AC12A-263E-479F-A478-FD8F4067F6F3}.Release|x64.Build.0 = Release|x64
|
||||
{D10AC12A-263E-479F-A478-FD8F4067F6F3}.Release|x86.ActiveCfg = Release|Win32
|
||||
{D10AC12A-263E-479F-A478-FD8F4067F6F3}.Release|x86.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
141
VisualStudio/filesync/filesync.vcxproj
Normal file
141
VisualStudio/filesync/filesync.vcxproj
Normal file
@@ -0,0 +1,141 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{D10AC12A-263E-479F-A478-FD8F4067F6F3}</ProjectGuid>
|
||||
<RootNamespace>filesync</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup />
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>_MBCS;%(PreprocessorDefinitions);WIN32;_CRT_SECURE_NO_WARNINGS</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EntryPointSymbol>mainCRTStartup</EntryPointSymbol>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\src\crc.c" />
|
||||
<ClCompile Include="..\..\src\filenode.c" />
|
||||
<ClCompile Include="..\..\src\filenodecmp.c" />
|
||||
<ClCompile Include="..\..\src\fileutil.c" />
|
||||
<ClCompile Include="..\..\src\main.c" />
|
||||
<ClCompile Include="..\..\src\util.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\src\crc.h" />
|
||||
<ClInclude Include="..\..\src\filenode.h" />
|
||||
<ClInclude Include="..\..\src\filenodecmp.h" />
|
||||
<ClInclude Include="..\..\src\fileutil.h" />
|
||||
<ClInclude Include="..\..\src\util.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
54
VisualStudio/filesync/filesync.vcxproj.filters
Normal file
54
VisualStudio/filesync/filesync.vcxproj.filters
Normal file
@@ -0,0 +1,54 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Archivos de código fuente">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Archivos de encabezado">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Archivos de recursos">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\src\crc.c">
|
||||
<Filter>Archivos de código fuente</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\filenode.c">
|
||||
<Filter>Archivos de código fuente</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\filenodecmp.c">
|
||||
<Filter>Archivos de código fuente</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\fileutil.c">
|
||||
<Filter>Archivos de código fuente</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\main.c">
|
||||
<Filter>Archivos de código fuente</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\util.c">
|
||||
<Filter>Archivos de código fuente</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\src\crc.h">
|
||||
<Filter>Archivos de encabezado</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\filenode.h">
|
||||
<Filter>Archivos de encabezado</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\filenodecmp.h">
|
||||
<Filter>Archivos de encabezado</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\fileutil.h">
|
||||
<Filter>Archivos de encabezado</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\util.h">
|
||||
<Filter>Archivos de encabezado</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -148,7 +148,7 @@ void FileNode_GetCRC(FileNode *fileNode, char *filePath) {
|
||||
}
|
||||
|
||||
void FileNode_SaveNode(FileNode *fileNode, FILE *file) {
|
||||
short name_len;
|
||||
int name_len;
|
||||
|
||||
// Escribir nombre
|
||||
name_len = strlen(fileNode->name);
|
||||
@@ -412,7 +412,6 @@ FileNode *FileNode_Refresh(FileNode *fileNode, char *filePath) {
|
||||
// Comprobar si ha sido modificado
|
||||
FileTime fileTime;
|
||||
long long size;
|
||||
int crc;
|
||||
|
||||
// Marcar normal
|
||||
fileNode->estado = FileStatus_None;
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include "filenode.h"
|
||||
#include "filenodecmp.h"
|
||||
|
||||
int maxDeltaTime=4000;
|
||||
int maxDeltaTime = 4000;
|
||||
|
||||
#define QueueNode(queue,node) (queue)->next = node; (queue) = node;
|
||||
|
||||
@@ -291,7 +291,7 @@ void AccionFileNode_CheckPair(FileNode *fileNodeLeft, FileNode *fileNodeRight,
|
||||
// Directorios
|
||||
|
||||
// Preparar accion para el par de directorios
|
||||
if (abs(fileNodeLeft->fileTime - fileNodeRight->fileTime) <= maxDeltaTime) { // appoximadamente iguales
|
||||
if (abs((int)(fileNodeLeft->fileTime - fileNodeRight->fileTime)) <= maxDeltaTime) { // appoximadamente iguales
|
||||
if (fileNodeRight->estado == FileStatus_Deleted
|
||||
&& fileNodeLeft->estado == FileStatus_Deleted) {
|
||||
actionFileNodeNew->action = AccionFileCmp_Nothing;
|
||||
@@ -344,7 +344,7 @@ void AccionFileNode_CheckPair(FileNode *fileNodeLeft, FileNode *fileNodeRight,
|
||||
// Ficheros
|
||||
|
||||
// Preparar accion para el par de ficheros
|
||||
if (abs(fileNodeLeft->fileTime - fileNodeRight->fileTime) <= maxDeltaTime) { // appoximadamente iguales
|
||||
if (abs((int)(fileNodeLeft->fileTime - fileNodeRight->fileTime)) <= maxDeltaTime) { // appoximadamente iguales
|
||||
if (fileNodeRight->estado == FileStatus_Deleted
|
||||
&& fileNodeLeft->estado == FileStatus_Deleted) {
|
||||
actionFileNodeNew->action = AccionFileCmp_Nothing;
|
||||
@@ -445,7 +445,7 @@ void AccionFileNode_Copy(FileNode *fileNodeLeft, FileNode *fileNodeRight,
|
||||
if (fileNodeLeft->estado != FileStatus_Deleted) {
|
||||
AccionFileNode_CompareChilds(actionFileNodeNew,
|
||||
actionFileNodeQueue, AccionFileNode_Copy);
|
||||
if (abs(fileNodeLeft->fileTime - fileNodeRight->fileTime)
|
||||
if (abs((int)(fileNodeLeft->fileTime - fileNodeRight->fileTime))
|
||||
<= maxDeltaTime) { // appox. equal
|
||||
actionFileNodeNew->action = AccionFileCmp_Nothing;
|
||||
} else {
|
||||
@@ -460,7 +460,7 @@ void AccionFileNode_Copy(FileNode *fileNodeLeft, FileNode *fileNodeRight,
|
||||
}
|
||||
} else {
|
||||
if (fileNodeLeft->estado != FileStatus_Deleted) {
|
||||
if (abs(fileNodeLeft->fileTime - fileNodeRight->fileTime)
|
||||
if (abs((int)(fileNodeLeft->fileTime - fileNodeRight->fileTime))
|
||||
<= maxDeltaTime) { // appox. equal
|
||||
actionFileNodeNew->action = AccionFileCmp_Nothing;
|
||||
} else {
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
#include <stdio.h>
|
||||
#include <dirent.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <utime.h>
|
||||
#include <time.h>
|
||||
#ifdef WIN32
|
||||
#define _WIN32_WINNT 0x0501
|
||||
#include <signal.h>
|
||||
#include <windows.h>
|
||||
#include <fcntl.h>
|
||||
#include <io.h>
|
||||
#ifdef WIN32
|
||||
# include <direct.h>
|
||||
# define _WIN32_WINNT 0x0501
|
||||
# include <windows.h>
|
||||
# include <io.h>
|
||||
# include <stdio.h>
|
||||
# include <signal.h>
|
||||
# include <fcntl.h>
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include "util.h"
|
||||
#include "fileutil.h"
|
||||
|
||||
#ifdef WIN32
|
||||
@@ -242,7 +242,7 @@ void File_GetSizeAndTime(char *fileName, long long *size, FileTime *time) {
|
||||
|
||||
#ifdef WIN32
|
||||
int File_MakeDirectory(char *path) {
|
||||
return (_mkdir(path));
|
||||
return (CreateDirectory(path, NULL));
|
||||
}
|
||||
#else
|
||||
int File_MakeDirectory(char *path) {
|
||||
@@ -260,7 +260,6 @@ void File_IterateDir(char *path,
|
||||
int fin = 0;
|
||||
int findnext_rc;
|
||||
char path_aux[MaxPath];
|
||||
char *ptr;
|
||||
|
||||
snprintf(path_aux, MaxPath, "%s/*", path);
|
||||
handle = _findfirst(path_aux, &fileinfo);
|
||||
@@ -312,11 +311,19 @@ void File_IterateDir(char *path,
|
||||
#endif
|
||||
|
||||
void File_Delete(char *path) {
|
||||
#ifdef WIN32
|
||||
remove(path);
|
||||
#else
|
||||
unlink(path);
|
||||
#endif
|
||||
}
|
||||
|
||||
void File_DeleteDirectory(char *path) {
|
||||
rmdir(path);
|
||||
void File_DeleteDirectory(char *path) {
|
||||
#ifndef WIN32
|
||||
rmdir(path);
|
||||
#else
|
||||
_rmdir(path);
|
||||
#endif
|
||||
}
|
||||
|
||||
#define MaxBuffer 16384
|
||||
|
||||
@@ -31,6 +31,7 @@ void Help(char *exe) {
|
||||
|
||||
FileNode *CheckDir(char *path, int recheck);
|
||||
int Sync(char *pathLeft, char *pathRight, int recheck, int dryRun);
|
||||
int Copy(char *pathLeft, char *pathRight, int reCheck, int dryRun);
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
if (argc < 2) {
|
||||
@@ -86,7 +87,6 @@ int main(int argc, char *argv[]) {
|
||||
} else if (!strcmp(argv[1], "dir") && argc == 3) {
|
||||
// Leer informacion de dir
|
||||
char *path = argv[2];
|
||||
char dirNodesFile[MaxPath];
|
||||
FileNode *fileNode;
|
||||
|
||||
fileNode = CheckDir(path, 1);
|
||||
|
||||
@@ -43,7 +43,7 @@ void Time_Pause(int pausa){
|
||||
do{
|
||||
diff=tend-t;
|
||||
if(diff>1000){
|
||||
Sleep(diff/1000);
|
||||
Sleep((int)diff/1000);
|
||||
}else{
|
||||
Sleep(0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user