Fix inconsistency regarding filebox multi_select
When only one file is selected, the lpstrFile variable contains only the path to that file, without the parent path before that, thus, the targets vector is empty and the path variable contains the actual path to the file. This is inconsistent with the scenario where multiple files are selected, in which targets contains the file paths and path contains the parent directory path.
This commit is contained in:
		
							parent
							
								
									3cb7dfae02
								
							
						
					
					
						commit
						7c442360ba
					
				@ -1517,6 +1517,15 @@ namespace nana
 | 
				
			|||||||
			path_type parent_path{ str };
 | 
								path_type parent_path{ str };
 | 
				
			||||||
			str += (len + 1);
 | 
								str += (len + 1);
 | 
				
			||||||
			
 | 
								
 | 
				
			||||||
 | 
								// if only one file was selected, the ofn.lpstrFile
 | 
				
			||||||
 | 
								// is returning only that file, without any parent
 | 
				
			||||||
 | 
								if (!*str)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									targets.emplace_back(parent_path);
 | 
				
			||||||
 | 
									impl_->path = parent_path.parent_path().u8string();
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								else
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
				while(*str)
 | 
									while(*str)
 | 
				
			||||||
				{
 | 
									{
 | 
				
			||||||
					len = ::wcslen(str);
 | 
										len = ::wcslen(str);
 | 
				
			||||||
@ -1525,6 +1534,7 @@ namespace nana
 | 
				
			|||||||
				}
 | 
									}
 | 
				
			||||||
				impl_->path = parent_path.u8string();
 | 
									impl_->path = parent_path.u8string();
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
		else
 | 
							else
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			wfile.resize(std::wcslen(wfile.data()));
 | 
								wfile.resize(std::wcslen(wfile.data()));
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user