starting to add flipper
This commit is contained in:
@@ -1 +1,43 @@
|
||||
#include "flipper.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
const char* m_outputPath;
|
||||
const char* m_workingPath;
|
||||
flipper_buffer m_outputBuffer;
|
||||
flipper_buffer m_workingBuffer;
|
||||
|
||||
void FlipperWorkingDir(const char* path) {
|
||||
m_workingPath = path;
|
||||
}
|
||||
|
||||
void FlipperOutputDir(const char* path) {
|
||||
m_outputPath = path;
|
||||
}
|
||||
|
||||
void _UpdateBuffer(flipper_buffer* buffer, const char* path) {
|
||||
char command_buffer[1024];
|
||||
int path_size = strlen(path);
|
||||
char* command;
|
||||
memset(command, (path_size + 6) * sizeof(char), sizeof(char));
|
||||
|
||||
strcpy(command, "ls ");
|
||||
strcat(command, path);
|
||||
strcat(command, " -a");
|
||||
|
||||
FILE* f = popen(command,"r");
|
||||
fseek(f,0L,SEEK_END);
|
||||
long sz = ftell(f);
|
||||
fseek(f,0L,SEEK_SET);
|
||||
|
||||
|
||||
fread(command_buffer, sz,0,f);
|
||||
|
||||
fclose(f);
|
||||
|
||||
free(command);
|
||||
|
||||
// do stuff with the command buffer.
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user