1use std::error::Error;
2use std::path::PathBuf;
3
4#[cfg(target_os = "linux")]
5mod lib_linux;
6#[cfg(target_os = "linux")]
7use lib_linux as backend;
8
9#[cfg(target_os = "macos")]
10mod lib_macos;
11#[cfg(target_os = "macos")]
12use lib_macos as backend;
13
14#[cfg(target_os = "windows")]
15mod lib_windows;
16#[cfg(target_os = "windows")]
17use lib_windows as backend;
18
19pub fn open(file_path: PathBuf) -> Result<(), Box<dyn Error>> {
29 backend::open(file_path)
30}
31
32pub fn open_with(file_path: PathBuf) -> Result<(), Box<dyn Error>> {
42 backend::open_with(file_path)
43}
44
45pub fn show_in_folder(file_path: PathBuf) -> Result<(), Box<dyn Error>> {
55 backend::show_in_folder(file_path)
56}
57
58pub fn show_properties(file_path: PathBuf) -> Result<(), Box<dyn Error>> {
68 backend::show_properties(file_path)
69}
70
71#[cfg(test)]
72mod tests {
73 use super::*;
74 use std::path::PathBuf;
75
76 #[test]
77 fn test_open() {
78 let file_path = PathBuf::from("src/lib.rs");
79 let _result = open(file_path).unwrap();
80 }
81
82 #[test]
83 fn test_open_with() {
84 let file_path = PathBuf::from("src/lib.rs");
85 let _result = open_with(file_path).unwrap();
86 }
87
88 #[test]
89 fn test_open_folder() {
90 let file_path = PathBuf::from("src/lib.rs");
91 let _result = show_in_folder(file_path).unwrap();
92 }
93
94 #[test]
95 fn test_show_properties() {
96 let file_path = PathBuf::from("src/lib.rs");
97 let _result = show_properties(file_path).unwrap();
98 std::thread::sleep(std::time::Duration::from_millis(10000));
99 }
100}