Created
December 31, 2018 03:12
-
-
Save UndarkAido/cc413e6d4728e6bc82affc945f0ba8fc to your computer and use it in GitHub Desktop.
WSL CMake Redirect for Atom
This file contains hidden or 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
@echo off | |
powershell "%~dp0/%~n0.ps1 %*" | |
"XX" | Out-File -filepath C:\Users\Aidan\cmake.txt -append | |
$args -join " " | Out-File -filepath C:\Users\Aidan\cmake.txt -append | |
for ($i=0; $i -lt $args.length; $i++) { | |
if($args[$i].StartsWith("-G")){ | |
if($args[$i].substring(2) -eq "Unix"){ | |
$args[$i] = -join($args[$i],"\") | |
} | |
$args[$i] = $args[$i].substring(0, 2),$args[$i].substring(2) -join "" | |
} elseif($args[$i].StartsWith("-B") -or $args[$i].StartsWith("-H")){ | |
$args[$i + 1] = -join($args[$i].substring(2),$args[$i + 1]) | |
$args[$i + 1] = bash.exe -c "wslpath `'$($args[$i + 1])`'" | |
$args[$i] = -join($args[$i].substring(0, 2), $args[$i + 1]) | |
$args[$i + 1] = "" | |
} | |
} | |
bash.exe -c "$(([io.fileinfo]$MyInvocation.MyCommand.Definition).BaseName) $($args)"@echo off | |
powershell "%~dp0/%~n0.ps1 %*" |
This file contains hidden or 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
"XX" | Out-File -filepath C:\Users\Aidan\cmake.txt -append | |
$args -join " " | Out-File -filepath C:\Users\Aidan\cmake.txt -append | |
for ($i=0; $i -lt $args.length; $i++) { | |
if($args[$i].StartsWith("-G")){ | |
if($args[$i].substring(2) -eq "Unix"){ | |
$args[$i] = -join($args[$i],"\") | |
} | |
$args[$i] = $args[$i].substring(0, 2),$args[$i].substring(2) -join "" | |
} elseif($args[$i].StartsWith("-B") -or $args[$i].StartsWith("-H")){ | |
$args[$i + 1] = -join($args[$i].substring(2),$args[$i + 1]) | |
$args[$i + 1] = bash.exe -c "wslpath `'$($args[$i + 1])`'" | |
$args[$i] = -join($args[$i].substring(0, 2), $args[$i + 1]) | |
$args[$i + 1] = "" | |
} | |
} | |
bash.exe -c "$(([io.fileinfo]$MyInvocation.MyCommand.Definition).BaseName) $($args)" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment