Function opens Main Window and in case of previously created
        project is switches to /home directory
        This is fix in case that da creats a project
        and project was deleted and GUI was not closed yet
353205
def open_window(self, widget, data=None):
        
        if data is not None:
            self.data = data
        os.chdir(os.path.expanduser('~'))
        self.kwargs = dict()
        self.main_win.show_all()
219349
public static void main(String[] args) throws IOException, CheckedAnalysisException, InterruptedException {
        if (args.length != 2) {
            System.err.println("Usage: " + DiscoverSourceDirectories.class.getName() + " <project file> <root source dir>");
            System.exit(1);
        }

        Project project = Project.readProject(args[0]);

        IErrorLogger errorLogger = new IErrorLogger() {

            @Override
            public void reportMissingClass(ClassNotFoundException ex) {
                String className = ClassNotFoundExceptionParser.getMissingClassName(ex);
                if (className != null) {
                    logError("Missing class: " + className);
                } else {
                    logError("Missing class: " + ex);
                }
            }

            @Override
            public void reportMissingClass(ClassDescriptor classDescriptor) {
                logError("Missing class: " + classDescriptor.toDottedClassName());
            }

            @Override
            public void logError(String message) {
                System.err.println("Error: " + message);
            }

            @Override
            public void logError(String message, Throwable e) {
                logError(message + ": " + e.getMessage());
            }

            @Override
            public void reportSkippedAnalysis(MethodDescriptor method) {
                logError("Skipped analysis of method " + method.toString());
            }

        };

        DiscoverSourceDirectories.Progress progress = new DiscoverSourceDirectories.Progress() {

            @Override
            public void startRecursiveDirectorySearch() {
                System.out.print("Scanning directories...");
                System.out.flush();
            }

            @Override
            public void doneRecursiveDirectorySearch() {
                System.out.println("done");
            }

            @Override
            public void startScanningArchives(int numArchivesToScan) {
                System.out.print("Scanning " + numArchivesToScan + " archives..");
                System.out.flush();
            }

            @Override
            public void doneScanningArchives() {
                System.out.println("done");
            }

            @Override
            public void startScanningClasses(int numClassesToScan) {
                System.out.print("Scanning " + numClassesToScan + " classes...");
                System.out.flush();
            }

            @Override
            public void finishClass() {
                System.out.print(".");
                System.out.flush();
            }

            @Override
            public void doneScanningClasses() {
                System.out.println("done");
            }

            @Override
            public void finishArchive() {
                System.out.print(".");
                System.out.flush();
            }

            @Override
            public void startArchive(String name) {
                // noop
            }
        };

        DiscoverSourceDirectories discoverSourceDirectories = new DiscoverSourceDirectories();
        discoverSourceDirectories.setProject(project);
        discoverSourceDirectories.setRootSourceDirectory(args[1]);
        discoverSourceDirectories.setErrorLogger(errorLogger);
        discoverSourceDirectories.setProgress(progress);

        discoverSourceDirectories.execute();

        System.out.println("Found source directories:");
        for (String srcDir : discoverSourceDirectories.getDiscoveredSourceDirectoryList()) {
            System.out.println("  " + srcDir);
        }
    }
751343
def addNewMainWindow(self, settings=None, inspectorFullName=None):
        
        mainWindow = MainWindow(self)
        self.mainWindows.append(mainWindow)

        self.windowActionGroup.addAction(mainWindow.activateWindowAction)
        self.repopulateAllWindowMenus()

        if settings:
            mainWindow.readViewSettings(settings)

        if inspectorFullName:
            inspectorId = nameToIdentifier(inspectorFullName)
            mainWindow.setInspectorById(inspectorId)

        if mainWindow.inspectorRegItem: # can be None at start
            inspectorId = mainWindow.inspectorRegItem.identifier
            mainWindow.getInspectorActionById(inspectorId).setChecked(True)
            logger.info("Created new window with inspector: {}"
                        .format(mainWindow.inspectorRegItem.fullName))
        else:
            logger.info("Created new window without inspector")

        mainWindow.drawInspectorContents(reason=UpdateReason.NEW_MAIN_WINDOW)
        mainWindow.show()

        if sys.platform.startswith('darwin'):
            # Calling raise before the QApplication.exec_ only shows the last window
            # that was added. Therefore we also call activeWindow. However, this may not
            # always be desirable. TODO: make optional?
            mainWindow.raise_()
            pass

        return mainWindow
1345519
public function main()
    {
        // Check if all required data is present.
        $this->checkRequirements();

        // Add required properties.
        $contents = [
            'core' => $this->_coreVersion,
            'api'  => $this->_apiVersion,
        ];

        // Add projects.
        foreach ($this->_projects as $project) {
            $contents['projects'][$project]['version'] = null;
        }

        // Add default location for projects.
        if (!empty($this->_defaultProjectDir)) {
            $contents['defaults']['projects']['subdir'] = $this->_defaultProjectDir;
        }

        // Save the makefile.
        $dumper = new Dumper();
        file_put_contents($this->_makeFile, $dumper->dump($contents, 4));

    }
590937
public boolean onNewWindow()
    {
        String strLastCommand = Utility.addURLParam(null, Params.MENU, Constant.BLANK);  //"?menu="; // Blank command = home
        this.handleCommand(strLastCommand, this, ScreenConstants.USE_NEW_WINDOW | ScreenConstants.DONT_PUSH_TO_BROWSER);        // Process the last ?menu= command in a new window
        return true;    // Handled
    }
444439
public static void main(String[] args) {
        File dir = null;

        System.out.println("checkLocalRserve: " + checkLocalRserve());
        try {
            RConnection c = new RConnection();
            //c.eval("cat('123')");
            dir = new File(c.eval("getwd()").asString());
            System.err.println("wd: " + dir);
            //c.eval("flush.console <-function(...) return;"); // will crash without that...
            c.eval("download.file('https://www.r-project.org/',paste0(getwd(),'/log.txt'))");
            c.shutdown();
        } catch (Exception x) {
            x.printStackTrace();
        }

        if (new File(dir, "log.txt").exists()) {
            System.err.println("OK: file exists");
            if (new File(dir, "log.txt").length() > 10) {
                System.err.println("OK: file not empty");
            } else {
                System.err.println("NO: file EMPTY");
            }
        } else {
            System.err.println("NO: file DOES NOT exist");
        }
    }
291231
function defaultWindowsLocation() {
  var files = [
    process.env['PROGRAMFILES'] || 'C:\\Program Files',
    process.env['PROGRAMFILES(X86)'] || 'C:\\Program Files (x86)'
  ].map(function(prefix) {
    return path.join(prefix, 'Mozilla Firefox\\firefox.exe');
  });
  return io.exists(files[0]).then(function(exists) {
    return exists ? files[0] : io.exists(files[1]).then(function(exists) {
      return exists ? files[1] : null;
    });
  });
}
1298474
async function autoOpenLastProject () {
  const context = getContext()
  const id = context.db.get('config.lastOpenProject').value()
  if (id) {
    try {
      await open(id, context)
    } catch (e) {
      log(`Project can't be auto-opened`, id)
    }
  }
}
595319
def _open_path_window(self):
        
        self.data['top_assistant'] = self.top_assistant
        self.data['current_main_assistant'] = self.get_current_main_assistant()
        self.data['kwargs'] = self.kwargs
        self.path_window.open_window(self.data)
        self.main_win.hide()
367398
def set_project_dir(self, directory):
        """"""
        if directory is not None:
            self.treewidget.set_root_path(osp.dirname(directory))
            self.treewidget.set_folder_names([osp.basename(directory)])
        self.treewidget.setup_project_view()
        try:
            self.treewidget.setExpanded(self.treewidget.get_index(directory),
                                        True)
        except TypeError:
            pass
1215227
function main() {
  var topWindow = window.top;
  var isTop = window.top === window;

  // Check the top window for options.
  var options = null;
  try {
    var optionsEl = topWindow.document.querySelector('x-wtf-options');
    if (optionsEl) {
      // Options exist in the DOM, use those.
      options = JSON.parse(optionsEl.text);
    }
  } catch (e) {
    // Failed, likely because of cross-domain iframe issues.
  }

  // Grab options - if not found, not injected.
  if (!options) {
    options = fetchOptions(topWindow);
  }
  if (!options) {
    return;
  }

  // Add options to the document for other frames/etc to find.
  if (!optionsEl) {
    try {
      optionsEl = document.createElement('x-wtf-options');
      optionsEl.text = JSON.stringify(options);
      topWindow.document.documentElement.appendChild(optionsEl);
    } catch (e) {
      // Failed, likely because of cross-domain iframe issues.
    }
  }

  if (options['__instrumented__']) {
    // Instrumentation mode.
    if (isTop) {
      // Create a blob that is both the falafel and process scripts.
      // This is used to create the worker.
      var xhr = new XMLHttpRequest();
      xhr.open('GET', chrome.extension.getURL('third_party/falafel.js'), false);
      xhr.send();
      var falafelSource = xhr.responseText;
      xhr = new XMLHttpRequest();
      xhr.open('GET', chrome.extension.getURL('wtf-process.js'), false);
      xhr.send();
      var processSource = xhr.responseText;
      var blob = new Blob([
        falafelSource,
        processSource
      ], {
        type: 'application/javascript'
      });
      var blobUrl = URL.createObjectURL(blob);
      options['wtf.instrumentation.blob'] = blobUrl;

      injectScriptFile(chrome.extension.getURL('third_party/falafel.js'));
      injectScriptFile(chrome.extension.getURL('wtf-process.js'));
      injectScriptFile(chrome.extension.getURL('wtf-call-tracing.js'));
    }
    injectScriptFunction(function(options) {
      // If we are nested in an iframe, protect against cross-origin errors.
      try {
        window.top.wtfi.prepare(options, window);
      } catch (e) {
      }
    }, [
      options
    ]);
  } else {
    // Normal tracing mode.
    // Inject the tracing framework script and the prepare function.
    if (isTop) {
      var traceScriptUrl =
        chrome.extension.getURL('wtf_trace_web_js_compiled.js');
      injectScriptFunction(function(traceScriptUrl) {
        window.WTF_TRACE_SCRIPT_URL = traceScriptUrl;
      }, [traceScriptUrl]);
      injectScriptFile(traceScriptUrl);
    }
    injectScriptFunction(function(options) {
      // If we are nested in an iframe, protect against cross-origin errors.
      try {
        window.top.wtf.trace.prepare(options, window);
      } catch (e) {
      }
    }, [
      options
    ]);

    if (isTop) {
      // Inject addons, if required.
      var addons = injectAddons(options['wtf.addons'] || []);
      // Inject preparation code to start tracing with the desired options.
      injectScriptFunction(startTracing, [
        addons
      ]);
    }
  }

  if (isTop) {
    setupCommunications();
  }
}
896193
def init(args):
    
    # working directory
    dir_path = Path().absolute()

    if not args.project_name or args.project_name.find("/") >= 0:
        print(
            "{}You should specify a valid project name{}".format(
                utils.colors.FAIL, utils.colors.ENDC
            )
        )
        return

    project_path = dir_path / args.project_name

    # Create the Home Documentation's directory
    if not project_path.exists():
        project_path.mkdir()
    else:
        print(
            "{}This project already exists{}".format(
                utils.colors.FAIL, utils.colors.ENDC
            )
        )
        return

    # Directory with the Home Documentation's source code
    home_doc_path = project_path / "docs"
    home_doc_path.mkdir()
    help_doc_path = home_doc_path / "help"
    help_doc_path.mkdir()

    file_path = Path(__file__).resolve().parent / "include"

    # Add initial files
    copyfile(file_path / "index.md", home_doc_path / "index.md")
    copyfile(file_path / "How_To_Use_Mkinx.md", help_doc_path / "How_To_Use_Mkinx.md")
    copyfile(
        file_path / "Writing_Sphinx_Documentation.md",
        help_doc_path / "Writing_Sphinx_Documentation.md",
    )

    with open(file_path / "mkdocs.yml", "r") as f:
        lines = f.readlines()

    input_text = "What is your Documentation's name"
    input_text += " (it can be changed later in mkdocs.yml)?\n"
    input_text += "[Default: {} - Home Documentation]\n"

    site_name = input(input_text.format(args.project_name.capitalize()))
    if not site_name:
        site_name = "{} - Home Documentation".format(args.project_name.capitalize())

    lines[0] = "site_name: {}\n".format(site_name)

    with open(project_path / "mkdocs.yml", "w") as f:
        f.writelines(lines)

    example_project_path = project_path / "example_project" / "example_project"

    windows = "y" if sys.platform in {"win32", "cygwin"} else "n"

    copytree(file_path / "example_project", example_project_path)
    move(str(example_project_path / "source"), str(project_path / "example_project"))
    move(
        str(project_path / "example_project" / "example_project" / "Makefile"),
        str(project_path / "example_project"),
    )
    if windows == "y":
        move(
            str(project_path / "example_project" / "example_project" / "make.bat"),
            str(project_path / "example_project"),
        )
    else:
        os.remove(
            str(project_path / "example_project" / "example_project" / "make.bat")
        )

    static = project_path / "example_project" / "source"
    static /= "_static"
    if not static.exists():
        static.mkdir()

    _ = subprocess.check_output(
        "cd {} && mkinx build -F -A > /dev/null".format(args.project_name), shell=True
    )

    print(
        "\n\n",
        utils.colors.OKBLUE,
        "{}/{} created as a showcase of how mkinx works".format(
            args.project_name, "example_project"
        ),
        utils.colors.ENDC,
    )

    print(
        "\n",
        utils.colors.OKGREEN,
        "Success!",
        utils.colors.ENDC,
        "You can now start your Docs in ./{}\n".format(args.project_name),
        utils.colors.HEADER,
        "$ cd ./{}".format(args.project_name),
        utils.colors.ENDC,
    )
    print(
        "  Start the server from within your Docs to see them \n  (default",
        "port is 8443 but you can change it with the -s flag):",
    )
    print(
        utils.colors.HEADER,
        " {} $ mkinx serve\n".format(args.project_name),
        utils.colors.ENDC,
    )
954638
def open_new_window(self, switch_to=True):
        
        self.driver.execute_script("window.open('');")
        time.sleep(0.01)
        if switch_to:
            self.switch_to_window(len(self.driver.window_handles) - 1)
1181320
public static void main(String args[]) {
		String home = "/home/user1/content/myfolder";
		String file = "/home/user1/figures/fig.png";
		System.out.println("home = " + home);
		System.out.println("file = " + file);
		System.out.println("path = " + getRelativePath(new File(home),new File(file)));
	}
58416
def add_project_ui(self):
        

        directory = umbra.ui.common.store_last_browsed_path(QFileDialog.getExistingDirectory(self,
                                                                                             "Add Project:",
                                                                                             RuntimeGlobals.last_browsed_path))
        if not directory:
            return False

        return self.add_project(directory)
201609
function main() {
    const options = queryOptions();
    switch (options.porting) {
        case 'build':
            runBuild(options)
            .catch((reason) => {
                console.error(reason);
                process.exit(1);
            });
            break;
        case 'arrange':
            runArrange(options);
            break;
        case 'rebase':
            runRebase(options);
            break;
        case 'clean':
            runClean(options);
            break;
    }
}
995302
function _watchProjectRoot(rootPath) {
        FileSystem.on("change", _fileSystemChange);
        FileSystem.on("rename", _fileSystemRename);

        FileSystem.watch(FileSystem.getDirectoryForPath(rootPath), ProjectModel._shouldShowName, ProjectModel.defaultIgnoreGlobs, function (err) {
            if (err === FileSystemError.TOO_MANY_ENTRIES) {
                if (!_projectWarnedForTooManyFiles) {
                    _showErrorDialog(ERR_TYPE_MAX_FILES);
                    _projectWarnedForTooManyFiles = true;
                }
            } else if (err) {
                console.error("Error watching project root: ", rootPath, err);
            }
        });

        // Reset allFiles cache
        model._resetCache();
    }