File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -139,6 +139,8 @@ pub fn parted_list_partition() -> Vec<Disk> {
139
139
let x = x. to_vec ( ) ;
140
140
let mut partition = Vec :: < Partition > :: new ( ) ;
141
141
142
+ let mut index = 0 ;
143
+
142
144
for part in vec_partition_parted. iter ( ) {
143
145
let number: Option < String > = is_available_string ( part[ "number" ] . to_string ( ) ) ;
144
146
let start: Option < String > = is_available_string ( part[ "start" ] . to_string ( ) ) ;
@@ -166,11 +168,12 @@ pub fn parted_list_partition() -> Vec<Disk> {
166
168
167
169
// memasukan tambahan nilai dari lsblk
168
170
if number_checker != 0 {
169
- let partition_path = & x[ number_checker - 1 ] ;
171
+ index += 1 ;
172
+ let partition_path = & x[ index - 1 ] ;
170
173
let partition_path =
171
174
is_available_string ( partition_path[ "name" ] . to_string ( ) ) ;
172
175
173
- let mountpoints = & x[ number_checker - 1 ] ;
176
+ let mountpoints = & x[ index - 1 ] ;
174
177
let mountpoints = is_available_vec ( mountpoints[ "mountpoints" ] . as_array ( ) ) ;
175
178
176
179
a_partition = Partition :: new (
You can’t perform that action at this time.
0 commit comments