-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e154a0f
commit 01ea285
Showing
3 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -74,3 +74,4 @@ Build amd64: | |
```bash | ||
make amd64 | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#include <iostream> | ||
#include <string> | ||
#include <cstdio> | ||
#include <sys/stat.h> | ||
|
||
inline bool CheckFileExist(const std::string& name) { | ||
struct stat buffer; | ||
return (stat (name.c_str(), &buffer) == 0); | ||
} | ||
|
||
int main(int argc, char** argv) | ||
{ | ||
std::string val = "./"; | ||
for (int i = 1; i < argc; ++i) | ||
{ | ||
std::string data = argv[i]; | ||
val += data + " "; | ||
} | ||
if (val == "./") | ||
{ | ||
std::cout << "Error: Please enter a app name! Like: run firefox" << std::endl; | ||
return 1; | ||
} | ||
|
||
if (CheckFileExist(argv[1])) | ||
{ | ||
int ret = std::system(val.c_str()); | ||
return 0; | ||
} | ||
else | ||
{ | ||
std::cout << "Error: File not found! \nFile Name:" << argv[1] << std::endl; | ||
return 1; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
CPP = g++ | ||
CPPFLAGS = -O3 | ||
build: | ||
mkdir -p bin | ||
$(CPP) $(CPPFLAGS) main.cpp -o bin/run | ||
x86: | ||
mkdir -p bin | ||
mkdir -p bin/x86 | ||
$(CPP) $(CPPFLAGS) -m32 main.cpp -o bin/x86/run | ||
amd64: | ||
mkdir -p bin | ||
mkdir -p bin/amd64 | ||
$(CPP) $(CPPFLAGS) -m64 main.cpp -o bin/amd64/run | ||
clean: | ||
if [ -d "bin" ]; then rm -Rf bin; fi |