Skip to content

Commit

Permalink
Allow to run .sw files. Treat them as .cpp.
Browse files Browse the repository at this point in the history
  • Loading branch information
egorpugin committed Apr 5, 2024
1 parent 413e0e5 commit f47e99f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ bin*

*.bat
*.sh
*.sw

*~
*.user
Expand Down
10 changes: 6 additions & 4 deletions src/sw/client/common/command/setup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,9 @@ SUBCOMMAND_DECL(setup)
}

// register .sw extension
// remove? improve?
/*{
// insecure? ok?
// to add .sw ext in VS - Tools | Options | Text Editor | File Extension | Microsoft Visual C++
{
const std::wstring id = L"sw.1";

winreg::RegKey ext(HKEY_CLASSES_ROOT, L".sw");
Expand All @@ -207,9 +208,10 @@ SUBCOMMAND_DECL(setup)
winreg::RegKey icon(HKEY_CLASSES_ROOT, id + L"\\DefaultIcon");
icon.SetStringValue(L"", prog);

// we run these files & pause on error, so user could check what went wrong
winreg::RegKey p(HKEY_CLASSES_ROOT, id + L"\\shell\\open\\command");
p.SetStringValue(L"", prog + L" build %1");
}*/
p.SetStringValue(L"", prog + L" -pause-on-error run %1 %*");
}

#elif defined(__linux__)
// https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html
Expand Down
2 changes: 2 additions & 0 deletions src/sw/driver/compiler/detect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@ const StringSet &getCppSourceFileExtensions()
// Objective-C
".mm",

".sw", // our special, to run .sw apps

// msvc modules
".ixx",
};
Expand Down

0 comments on commit f47e99f

Please sign in to comment.