Issue 6743 - Print error if -run is followed by a path with an incompatible extension #1460

Merged
merged 1 commit into from Jan 17, 2013

Conversation

Projects
None yet
2 participants
@ghost

ghost commented Jan 10, 2013

http://d.puremagic.com/issues/show_bug.cgi?id=6743

Extensionless files are OK, this is a DMD feature, we only have to check when there's an extension. I'm allowing .di files because this already worked before, there's no need to break this feature even though it might be uncommon to run .di files.

ghost closed this Jan 10, 2013

ghost reopened this Jan 10, 2013

@WalterBright WalterBright commented on an outdated diff Jan 13, 2013

src/mars.c
@@ -867,6 +867,14 @@ int tryMain(size_t argc, char *argv[])
global.params.runargs_length = ((i >= argcstart) ? argc : argcstart) - i - 1;
if (global.params.runargs_length)
{
+ char *ext = FileName::ext(argv[i + 1]);
+ if (ext && FileName::equals(ext, "d") == 0
+ && FileName::equals(ext, "di") == 0)
+ {
+ error(0, "-run must be followed by a source file, not '%s'", argv[i + 1]);
+ return EXIT_FAILURE;
@WalterBright

WalterBright Jan 13, 2013

Owner

More appropriate to do a break; here.

@ghost

ghost commented Jan 13, 2013

Ok, inserted break.

@WalterBright WalterBright added a commit that referenced this pull request Jan 17, 2013

@WalterBright WalterBright Merge pull request #1460 from AndrejMitrovic/Fix6743
Issue 6743 - Print error if -run is followed by a path with an incompatible extension
d464251

@WalterBright WalterBright merged commit d464251 into dlang:master Jan 17, 2013

1 check passed

default Pass: 10
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment