COMMON: Make EVENT_DROP_FILE use a Path

This commit is contained in:
Le Philousophe 2023-09-10 10:24:14 +02:00 committed by Eugene Sandulenko
parent e0fd69bda0
commit fc3f03d21d
6 changed files with 7 additions and 7 deletions

View File

@ -51,7 +51,7 @@ bool RISCOSSdlEventSource::handleSysWMEvent(SDL_Event &ev, Common::Event &event)
case 3: // Message_DataLoad
filename = (char *)(pollBlock) + 44;
event.type = Common::EVENT_DROP_FILE;
event.path = RISCOS_Utils::toUnix(Common::String(filename));
event.path = Common::Path(RISCOS_Utils::toUnix(Common::String(filename)));
// Acknowledge that the event has been received
pollBlock[4] = 4; // Message_DataLoadAck

View File

@ -554,7 +554,7 @@ bool SdlEventSource::dispatchSDLEvent(SDL_Event &ev, Common::Event &event) {
case SDL_DROPFILE:
event.type = Common::EVENT_DROP_FILE;
event.path = Common::String(ev.drop.file);
event.path = Common::Path(ev.drop.file, Common::Path::kNativeSeparator);
SDL_free(ev.drop.file);
return true;

View File

@ -225,7 +225,7 @@ struct Event {
CustomEventType customType;
/** The path of the file or directory dragged to the ScummVM window. */
Common::String path;
Common::Path path;
/**
* Mouse movement since the last mouse movement event.

View File

@ -171,7 +171,7 @@ bool DownloadDialog::selectDirectories() {
void DownloadDialog::handleTickle() {
if (_close) {
if (_launcher)
_launcher->doGameDetection(_localDirectory.toString('/'));
_launcher->doGameDetection(_localDirectory);
close();
_close = false;
return;

View File

@ -623,7 +623,7 @@ void LauncherDialog::handleOtherEvent(const Common::Event &evt) {
Dialog::handleOtherEvent(evt);
if (evt.type == Common::EVENT_DROP_FILE) {
// If the path is a file, take the parent directory for the detection
Common::String path = evt.path;
Common::Path path = evt.path;
Common::FSNode node(path);
if (!node.isDirectory())
path = node.getParent().getPath();
@ -631,7 +631,7 @@ void LauncherDialog::handleOtherEvent(const Common::Event &evt) {
}
}
bool LauncherDialog::doGameDetection(const Common::String &path) {
bool LauncherDialog::doGameDetection(const Common::Path &path) {
// Allow user to add a new game to the list.
// 2) try to auto detect which game is in the directory, if we cannot
// determine it uniquely present a list of candidates to the user

View File

@ -120,7 +120,7 @@ public:
void handleKeyDown(Common::KeyState state) override;
void handleKeyUp(Common::KeyState state) override;
void handleOtherEvent(const Common::Event &evt) override;
bool doGameDetection(const Common::String &path);
bool doGameDetection(const Common::Path &path);
Common::String getGameConfig(int item, Common::String key);
protected:
EditTextWidget *_searchWidget;