Advertisement
Inksaver

PortableApps Minecraft Launcher

Mar 26th, 2020
6,625
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.35 KB | None | 0 0
  1. using System;
  2. using System.IO;
  3. using System.Diagnostics;
  4.  
  5. namespace MinecraftLauncher
  6. {
  7.     class Program
  8.     {
  9.         static void Main(string[] args)
  10.         {
  11.             // find the working directory, eg C:\Users\Public\PortableApps\MinecraftPortable
  12.             // or X:\PortableApps\MinecraftPortable where X is the USB drive letter
  13.             string appPath = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
  14.             /*
  15.             Add the location of Mojang's MinecraftLauncher in the 'Minecraft' sub-folder
  16.             PortableApps usually uses  'app' as the subfolder name
  17.             eg X:\PortableApps\MinecraftPortable\app\mcp_data\.minecraft
  18.             This code is used where the folder stucture is:
  19.             X:\PortableApps\MinecraftPortable\Minecraft\mcp_data\.minecraft
  20.             */
  21.             string startFile = Path.Combine(appPath, "Minecraft", "MinecraftLauncher.exe");
  22.             ProcessStartInfo start = new ProcessStartInfo();
  23.             start.FileName = startFile; // X:\PortableApps\MinecraftPortable\Minecraft\MinecraftLauncher.exe - Mojang's file
  24.             //args = ' --workDir X:\PortableApps\MinecraftPortable\Minecraft\mcp_data\.minecraft'
  25.             start.Arguments = " --workDir " + Path.Combine(appPath, "Minecraft", "mcp_data",".minecraft");
  26.             Process.Start(start);
  27.         }
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement