Created
September 27, 2012 14:08
-
-
Save xdegtyarev/3794208 to your computer and use it in GitHub Desktop.
Unity Sublime Runner
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// main.cpp | |
// SublimeRunner | |
// | |
// Created by Alexander Degtyarev on 9/27/12. | |
// Copyright (c) 2012 Alexander Degtyarev. All rights reserved. | |
// | |
#include <iostream> | |
#include <sstream> | |
#include <string> | |
#include <algorithm> | |
#include <iostream> | |
int main(int argc, const char * argv[]) | |
{ | |
for (int i = 0; i<argc; i++) { | |
std::cout << argv[i]; | |
} | |
std::stringstream command; | |
command << "open subl -n "; | |
if(argc > 1) | |
{ | |
command << "\"" << argv[1] << "\""; | |
} | |
if(argc > 2) | |
{ | |
std::string str(argv[2]); | |
std::string lineNum = str.substr(6,14); | |
if(lineNum != "-1"){ | |
command << ":" << lineNum; | |
} | |
} | |
std::cout << command.str(); | |
system(command.str().c_str()); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment