D
deleted229251
Salut ^^, en m'ennuyant , j'ai décidée de faire quelque chose qui n'a pas été encore fais ^^
compilée des deb à partir de windows, le programme n'est pas encore terminée mais je mettrez à jour le post selon les avancement ^^
voila
compilée des deb à partir de windows, le programme n'est pas encore terminée mais je mettrez à jour le post selon les avancement ^^
Code:
#include <iostream>
#include <io.h> // For access().
#include <sys/types.h> // For stat().
#include <sys/stat.h> // For stat().
#include <string.h>
#include <libgzip/zip.h>
using namespace std;
string paramArgument;
string input;
string output;
string debSeach = ".deb";
bool FileExists(const string& filePatch)
{
if ( access( filePatch.c_str(), 0 ) == 0 )
{
struct stat status;
stat( filePatch.c_str(), &status );
if ( status.st_mode & S_IFDIR )
{
return false;
}
else
{
return true;
}
}
else
{
return false;
}
}
bool DirExists(const string& filePatch)
{
if ( access( filePatch.c_str(), 0 ) == 0 )
{
struct stat status;
stat( filePatch.c_str(), &status );
if ( status.st_mode & S_IFDIR )
{
return true;
}
else
{
return false;
}
}
else
{
return false;
}
}
void compress()
{
cout << "[DPKG] Compressing data in tar..." << endl;
cout << "[DPKG] Compressing data in gzip..." << endl;
}
void decompress()
{
cout << "[DPKG] Decompress coming soon :-)";
}
void Displayhelp()
{
cout << "Deb Compressor and Decompressor" << endl << "-------------------------------" << endl << "dpkg [SYNTAX] [INPUT] [OUTPUT]" << endl << endl << "-c Compress folder to deb." << endl << "-d Decompress deb to folder." << endl;
}
int main(int argc, char* argv[])
{
if(argc < 4)
{
Displayhelp();
}
else
{
paramArgument = argv[1];
input = argv[2];
output = argv[3];
if(paramArgument == "-d")
{
if (!DirExists(output))
{
cout << "Your output folder does't exist";
return 0;
}
int StringSizeforFormat = input.size() - 4;
string fileFormat = input.substr(StringSizeforFormat, StringSizeforFormat);
if (strstr(fileFormat.c_str(), debSeach.c_str()) != 0)
{
if (!FileExists(input))
{
cout << "Your input deb file does't exist";
return 0;
}
}
else
{
cout << "Your input file is not a deb";
return 0;
}
decompress();
}
else if (paramArgument == "-c")
{
if (!DirExists(input))
{
cout << "Your input folder does't exist";
return 0;
}
int StringSizeforFormat = output.size() - 4;
string fileFormat = output.substr(StringSizeforFormat, StringSizeforFormat);
if (strstr(fileFormat.c_str(), debSeach.c_str()) != 0)
{
if (!FileExists(output))
{
cout << "Your output deb file does't exist";
return 0;
}
}
else
{
cout << "Your output file is not a deb";
return 0;
}
compress();
}
else if (paramArgument == "-h")
{
Displayhelp();
}
else
{
cout << "Your specified syntax is not found, entry -h for help";
}
}
return 0;
}
voila
