File tree Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change
1
+ source_code.txt
2
+
1
3
# Generated by Cargo
2
4
# will have compiled files and executables
3
5
debug /
Original file line number Diff line number Diff line change
1
+ #!/bin/python
2
+ import os
3
+
4
+ def collect_rust_files (directory , output_file ):
5
+ with open (output_file , 'w' ) as outfile :
6
+ for root , dirs , files in os .walk (directory ):
7
+ for file in files :
8
+ if file .endswith ('.rs' ):
9
+ file_path = os .path .join (root , file )
10
+ outfile .write (f"---- { file_path } ----\n \n " )
11
+ with open (file_path , 'r' ) as infile :
12
+ outfile .write (infile .read ())
13
+ outfile .write ("\n \n " )
14
+
15
+ if __name__ == "__main__" :
16
+ source_directory = "./src"
17
+ output_file = "source_code.txt"
18
+
19
+ collect_rust_files (source_directory , output_file )
20
+ print (f"source code collected in { output_file } " )
You can’t perform that action at this time.
0 commit comments