testing-repository/README.md

112 lines
2.4 KiB
Markdown
Raw Normal View History

2020-09-14 21:23:20 +08:00
# testing-repository
2021-11-28 14:04:17 +08:00
2021-11-28 21:02:17 +08:00
## A testing repository
2020-09-14 21:24:13 +08:00
2022-02-13 20:53:38 +08:00
\[Experimental]: 1. The rust programming language is imported for some codes
2021-11-28 21:02:17 +08:00
2022-02-13 20:53:38 +08:00
2. A test of building Xe Release with Rust is going on.
\[News]: After gtk112 and gtk113, the submodule GCR_CMake is imported
2021-04-18 16:37:38 +08:00
2021-10-22 18:46:49 +08:00
Thanks for the project author https://github.com/Makman2/GCR_CMake
2021-04-18 16:37:38 +08:00
2022-08-07 14:46:36 +08:00
and the author of json: https://github.com/nlohmann/json[GitHub - nlohmann/json: JSON for Modern C++](https://github.com/nlohmann/json)
2022-05-07 13:49:27 +08:00
The test for Qt5 is starting, and some example from the Qt opensource example.
2021-10-22 18:45:59 +08:00
(Actually, I forked the project for convenience)
2021-10-22 18:42:04 +08:00
2021-11-28 21:02:17 +08:00
### These contents are outdated:
2021-10-22 18:42:04 +08:00
Note: To minimize the repeated files,I put the same files as public resource
2021-11-28 21:02:17 +08:00
The file name is above:
public\_res\<filename\>\_\<file extension\> or public\_res\<filename\>\_\<file extension\>
2021-12-01 16:07:28 +08:00
Please compile with g++ or gcc (Clang is also supported)
2021-10-22 18:42:04 +08:00
2020-09-14 21:23:20 +08:00
(Visual Studio may have issues)
2020-09-29 19:43:13 +08:00
2020-09-15 11:49:20 +08:00
Ege dircitory need ege 19.01 and above to complie
2020-09-29 19:43:13 +08:00
2020-09-29 19:42:50 +08:00
C/C++ code using gtk2 needs gtk 2.24.10
2020-11-22 22:25:29 +08:00
2021-11-28 21:02:17 +08:00
#### For Gtk3 codes:
2020-11-22 22:25:29 +08:00
before gtk17 supports Gtk3.6.4
2020-11-20 22:00:57 +08:00
gtk17 and above removed support for gtk3.18 and below
2020-09-16 08:19:28 +08:00
2021-11-28 21:02:17 +08:00
Win32 exe supports WinXP and above
2021-12-01 16:07:28 +08:00
The Sample Code to get current dir
2022-02-13 21:48:14 +08:00
```c
2021-12-01 16:07:28 +08:00
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main(int argc,char ** argv){
//argv[0] for full application running path
const char * src = *argv;
//Get Size and store the content
int len = strlen(src);
char * tmp = malloc(len);
//The Name of application is "args.exe" for windows
//And named "args" for linux
#ifdef _WIN32
strncpy(tmp,src,len-8);
tmp[len-8]='\0';
#else
strncpy(tmp,src,len-4);
tmp[len-4]='\0';
#endif
printf("%s\n",tmp);
free(tmp);
return 0;
}
```
Java version
2022-02-13 20:53:38 +08:00
2021-12-01 16:07:28 +08:00
```java
public class Args{
public static void main(String[] args){
System.out.println(System.getProperty("user.dir"));
}
}
```
2022-02-14 11:59:10 +08:00
Rust Version
2022-02-13 20:53:38 +08:00
2021-12-01 16:07:28 +08:00
```rust
2022-02-13 21:48:14 +08:00
use std::env;
2022-02-13 20:53:38 +08:00
2022-02-13 21:48:14 +08:00
fn main() {
// Get executive path
let args: Vec<String> = env::args().collect();
let execpath: String = args[0].clone();
// Handle the path string
let exec_len: usize = 13;
2022-02-14 11:59:10 +08:00
let length: usize;
if cfg!(target_os = "windows") {
length = execpath.len() - exec_len - 4;
} else {
length = execpath.len() - exec_len;
}
2022-02-13 21:48:14 +08:00
let path: &str = &execpath[0..length];
// Print the path of executive
println!("{}", path);
2021-12-01 16:07:28 +08:00
}
```
2022-07-25 12:32:44 +08:00
### Thanks:
Json lib for C++: https://github.com/nlohmann/json