diff --git a/.gitignore b/.gitignore
index e9426f3..5f9cf08 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,3 +2,9 @@
*.exe
build
+*/.vs/*
+*.opensdf
+*.sdf
+VisualStudio/filesync/Debug
+*.user
+VisualStudio/Debug/*
diff --git a/VisualStudio/filesync.sln b/VisualStudio/filesync.sln
new file mode 100644
index 0000000..42b3e1e
--- /dev/null
+++ b/VisualStudio/filesync.sln
@@ -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
diff --git a/VisualStudio/filesync/filesync.vcxproj b/VisualStudio/filesync/filesync.vcxproj
new file mode 100644
index 0000000..49f52ff
--- /dev/null
+++ b/VisualStudio/filesync/filesync.vcxproj
@@ -0,0 +1,141 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Release
+ Win32
+
+
+ Debug
+ x64
+
+
+ Release
+ x64
+
+
+
+ {D10AC12A-263E-479F-A478-FD8F4067F6F3}
+ filesync
+ 8.1
+
+
+
+ Application
+ true
+ v140
+ MultiByte
+
+
+ Application
+ false
+ v140
+ true
+ MultiByte
+
+
+ Application
+ true
+ v140
+ MultiByte
+
+
+ Application
+ false
+ v140
+ true
+ MultiByte
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Level3
+ Disabled
+ true
+ _MBCS;%(PreprocessorDefinitions);WIN32;_CRT_SECURE_NO_WARNINGS
+
+
+ true
+ Console
+ mainCRTStartup
+
+
+
+
+ Level3
+ Disabled
+ true
+
+
+ true
+
+
+
+
+ Level3
+ MaxSpeed
+ true
+ true
+ true
+
+
+ true
+ true
+ true
+
+
+
+
+ Level3
+ MaxSpeed
+ true
+ true
+ true
+
+
+ true
+ true
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/VisualStudio/filesync/filesync.vcxproj.filters b/VisualStudio/filesync/filesync.vcxproj.filters
new file mode 100644
index 0000000..5bdcd05
--- /dev/null
+++ b/VisualStudio/filesync/filesync.vcxproj.filters
@@ -0,0 +1,54 @@
+
+
+
+
+ {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
+ cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
+
+
+ {93995380-89BD-4b04-88EB-625FBE52EBFB}
+ h;hh;hpp;hxx;hm;inl;inc;xsd
+
+
+ {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
+ rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
+
+
+
+
+ Archivos de código fuente
+
+
+ Archivos de código fuente
+
+
+ Archivos de código fuente
+
+
+ Archivos de código fuente
+
+
+ Archivos de código fuente
+
+
+ Archivos de código fuente
+
+
+
+
+ Archivos de encabezado
+
+
+ Archivos de encabezado
+
+
+ Archivos de encabezado
+
+
+ Archivos de encabezado
+
+
+ Archivos de encabezado
+
+
+
\ No newline at end of file
diff --git a/src/filenode.c b/src/filenode.c
index 5f368de..2f233f1 100644
--- a/src/filenode.c
+++ b/src/filenode.c
@@ -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;
diff --git a/src/filenodecmp.c b/src/filenodecmp.c
index 20ab748..ab4f9f4 100644
--- a/src/filenodecmp.c
+++ b/src/filenodecmp.c
@@ -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 {
diff --git a/src/fileutil.c b/src/fileutil.c
index 423c039..a1a0540 100644
--- a/src/fileutil.c
+++ b/src/fileutil.c
@@ -1,21 +1,21 @@
#include
-#include
#include
#include
#include
-#include
-#include
#include
-#ifdef WIN32
-#define _WIN32_WINNT 0x0501
-#include
-#include
-#include
-#include
+#ifdef WIN32
+# include
+# define _WIN32_WINNT 0x0501
+# include
+# include
+# include
+# include
+# include
#else
#include
#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
diff --git a/src/main.c b/src/main.c
index 241556b..544d70d 100644
--- a/src/main.c
+++ b/src/main.c
@@ -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);
diff --git a/src/util.c b/src/util.c
index 6a5ef8b..8b70c7c 100644
--- a/src/util.c
+++ b/src/util.c
@@ -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);
}