File tree Expand file tree Collapse file tree 1 file changed +4
-7
lines changed
crates/processing_pyo3/src Expand file tree Collapse file tree 1 file changed +4
-7
lines changed Original file line number Diff line number Diff line change @@ -12,21 +12,18 @@ mod glfw;
1212mod graphics;
1313
1414use graphics:: { Graphics , get_graphics, get_graphics_mut} ;
15- use pyo3:: { exceptions:: PyRuntimeError , prelude:: * , types :: PyString } ;
15+ use pyo3:: { exceptions:: PyRuntimeError , prelude:: * } ;
1616
1717#[ pymodule]
1818fn processing ( m : & Bound < ' _ , PyModule > ) -> PyResult < ( ) > {
1919 Python :: attach ( |py| {
2020 let sys = PyModule :: import ( py, "sys" ) ?;
2121 let argv: Vec < String > = sys. getattr ( "argv" ) ?. extract ( ) ?;
22+ let filename: & str = argv[ 0 ] . as_str ( ) ;
2223 let os = PyModule :: import ( py, "os" ) ?;
2324 let path = os. getattr ( "path" ) ?;
24- let dirname = path
25- . getattr ( "dirname" ) ?
26- . call1 ( pyo3:: types:: PyTuple :: new ( py, & [ & argv[ 0 ] ] ) ?) ?;
27- let abspath = path
28- . getattr ( "abspath" ) ?
29- . call1 ( pyo3:: types:: PyTuple :: new ( py, & [ dirname] ) ?) ?;
25+ let dirname = path. getattr ( "dirname" ) ?. call1 ( ( filename, ) ) ?;
26+ let abspath = path. getattr ( "abspath" ) ?. call1 ( ( dirname, ) ) ?;
3027 let abspath = path. getattr ( "join" ) ?. call1 ( ( abspath, "assets" ) ) ?;
3128
3229 m. add ( "_root_dir" , abspath) ?;
You can’t perform that action at this time.
0 commit comments