Skip to content

Commit

Permalink
Fix linux file navigation (#925)
Browse files Browse the repository at this point in the history
Linux file navigation with spaces would truncate the file name.
Fix it with this more hacky approach. There Must Be A Better Way
but This Works.

Closes #924
  • Loading branch information
baconpaul authored Jun 21, 2019
1 parent 4ed615c commit 7500664
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/common/gui/SurgeGUIEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2760,6 +2760,7 @@ void SurgeGUIEditor::showSettingsMenu(CRect &menuRect)
if( sf.compare(sf.length() - sfx.length(), sfx.length(), sfx) != 0 )
{
Surge::UserInteractions::promptError( "Please only select .scl files", "Invalid Choice" );
std::cout << "FILE is [" << sf << "]" << std::endl;
return;
}
}
Expand Down
6 changes: 5 additions & 1 deletion src/linux/UserInteractionsLinux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,14 @@ void promptFileOpenDialog(const std::string& initialDirectory,
return;
}
char buffer[ 1024 ];
if (!fscanf(z, "%1024s", buffer))
if (fgets(buffer, sizeof(buffer), z) == NULL)
{
return;
}
for( int i=0; i<1024; ++i )
if( buffer[i] == '\n' )
buffer[i] = 0;

pclose(z);

callbackOnOpen(buffer);
Expand Down

0 comments on commit 7500664

Please sign in to comment.