Skip to content

Commit

Permalink
Merge pull request StarCoreSE#211 from InvalidArgument3/ai-init-fix
Browse files Browse the repository at this point in the history
better rm symlink bat
  • Loading branch information
InvalidArgument3 authored Sep 29, 2024
2 parents ee1970a + d6a9d9a commit 0e876dd
Show file tree
Hide file tree
Showing 15 changed files with 79 additions and 47 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using OrreryFrameworkDemo.Data.Scripts.OrreryFrameworkDemo.Communication.ProjectileBases;
using OrreryFrameworkDemo.Data.Scripts.OrreryFrameworkDemo.Communication.WeaponBases;
using OrreryFramework.Communication.ProjectileBases;
using OrreryFramework.Communication.WeaponBases;
using ProtoBuf;
using Sandbox.ModAPI;
using System.Collections.Generic;

namespace OrreryFrameworkDemo.Data.Scripts.OrreryFrameworkDemo.Communication
namespace OrreryFramework.Communication
{
partial class HeartDefinitions
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using VRage.Game.Components;
using VRage.Utils;

namespace OrreryFrameworkDemo.Data.Scripts.OrreryFrameworkDemo.Communication
namespace OrreryFramework.Communication
{
[MySessionComponentDescriptor(MyUpdateOrder.BeforeSimulation, Priority = int.MaxValue)]
internal class DefinitionSender : MySessionComponentBase
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Heart_Module.Data.Scripts.HeartModule.Projectiles.StandardClasses;
using OrreryFrameworkDemo.Data.Scripts.OrreryFrameworkDemo.Communication.ProjectileBases;
using OrreryFrameworkDemo.Data.Scripts.OrreryFrameworkDemo.Communication.WeaponBases;
using OrreryFramework.Communication.ProjectileBases;
using OrreryFramework.Communication.WeaponBases;
using Sandbox.ModAPI;
using System;
using System.Collections.Generic;
Expand All @@ -9,7 +9,7 @@
using VRage.Utils;
using VRageMath;

namespace OrreryFrameworkDemo.Data.Scripts.OrreryFrameworkDemo.Communication
namespace OrreryFramework.Communication
{
public class HeartApi
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
using VRage.Utils;
using VRageMath;

namespace OrreryFrameworkDemo.Data.Scripts.OrreryFrameworkDemo.Communication.ProjectileBases
namespace OrreryFramework.Communication.ProjectileBases
{
/// <summary>
/// Standard serializable projectile definition.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace OrreryFrameworkDemo.Data.Scripts.OrreryFrameworkDemo.Communication
namespace OrreryFramework.Communication
{
public enum IFF_Enum
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using ProtoBuf;
using System;

namespace OrreryFrameworkDemo.Data.Scripts.OrreryFrameworkDemo.Communication.WeaponBases
namespace OrreryFramework.Communication.WeaponBases
{
/// <summary>
/// Standard serializable weapon definition. Add onto definition base using the partial modifier.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using OrreryFrameworkDemo.Data.Scripts.OrreryFrameworkDemo.Communication.WeaponBases;
using OrreryFramework.Communication.WeaponBases;
using System;

namespace OrreryFrameworkDemo.Data.Scripts.OrreryFrameworkDemo.Communication
namespace OrreryFramework.Communication
{
partial class HeartDefinitions
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using EmptyKeys.UserInterface.Generated.StoreBlockView_Bindings;
using Heart_Module.Data.Scripts.HeartModule.Projectiles.StandardClasses;
using OrreryFrameworkDemo.Data.Scripts.OrreryFrameworkDemo.Communication.ProjectileBases;
using OrreryFramework.Communication.ProjectileBases;
using Sandbox.Game;
using Sandbox.ModAPI;
using System;
Expand All @@ -10,7 +10,7 @@
using VRage.Utils;
using VRageMath;

namespace OrreryFrameworkDemo.Data.Scripts.OrreryFrameworkDemo.Communication
namespace OrreryFramework.Communication
{
partial class HeartDefinitions
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using OrreryFrameworkDemo.Data.Scripts.OrreryFrameworkDemo.Communication.WeaponBases;
using OrreryFramework.Communication.WeaponBases;
using System;

namespace OrreryFrameworkDemo.Data.Scripts.OrreryFrameworkDemo.Communication
namespace OrreryFramework.Communication
{
partial class HeartDefinitions
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using OrreryFrameworkDemo.Data.Scripts.OrreryFrameworkDemo.Communication.WeaponBases;
using OrreryFramework.Communication.WeaponBases;
using System;

namespace OrreryFrameworkDemo.Data.Scripts.OrreryFrameworkDemo.Communication
namespace OrreryFramework.Communication
{
partial class HeartDefinitions
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using OrreryFrameworkDemo.Data.Scripts.OrreryFrameworkDemo.Communication.WeaponBases;
using OrreryFramework.Communication.WeaponBases;
using System;

namespace OrreryFrameworkDemo.Data.Scripts.OrreryFrameworkDemo.Communication
namespace OrreryFramework.Communication
{
partial class HeartDefinitions
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using OrreryFrameworkDemo.Data.Scripts.OrreryFrameworkDemo.Communication.WeaponBases;
using OrreryFramework.Communication.WeaponBases;
using System;

namespace OrreryFrameworkDemo.Data.Scripts.OrreryFrameworkDemo.Communication
namespace OrreryFramework.Communication
{
partial class HeartDefinitions
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace OrreryFrameworkDemo.Data.Scripts.OrreryFrameworkDemo.Communication
namespace OrreryFramework.Communication
{
partial class HeartDefinitions
{
Expand Down
80 changes: 56 additions & 24 deletions remove-semods-symlinks.bat
Original file line number Diff line number Diff line change
@@ -1,39 +1,71 @@
@echo off
setlocal enabledelayedexpansion

:: Check if the script is running with administrative privileges
NET SESSION >NUL 2>&1
if %ERRORLEVEL% NEQ 0 (
echo Please run this script as administrator!
REM Check if the script is running as administrator
>nul 2>&1 "%SystemRoot%\system32\cacls.exe" "%SystemRoot%\system32\config\system"
if '%errorlevel%' NEQ '0' (
echo.
echo ====================================================
echo This script must be run as an administrator to remove symlinks!
echo Right-click the script and select "Run as administrator".
echo ====================================================
echo.
pause
exit /b 1
exit /b
)

set "targetDir=%APPDATA%\SpaceEngineers\Mods"
set "desktopDir=%USERPROFILE%\Desktop\SpaceEngineersModsBackup"
REM Define the root Space Engineers mod directory
set modRootDir="%APPDATA%\SpaceEngineers\Mods"

:: Creating desktop directory if it doesn't exist
if not exist "%desktopDir%" (
mkdir "%desktopDir%"
REM Check if the mod directory exists
if not exist !modRootDir! (
echo Mod directory does not exist: !modRootDir!
echo Please ensure that the Space Engineers game has created mod directories.
pause
exit /b
)

:: Copying non-symbolic link folders to the desktop
for /d %%i in ("%targetDir%\*") do (
set "folderName=%%~nxi"
fsutil reparsepoint query "%%i" > nul 2>&1
if errorlevel 1 (
robocopy "%%i" "%desktopDir%\!folderName!" /E /NFL /NDL /NJH /NJS /nc /ns /np
)
REM Change to the mod directory
cd /d "!modRootDir!"

REM List only symbolic links in the mod directory
echo.
echo Searching for symbolic links in: !modRootDir!
set foundSymlink=false
for /f "tokens=*" %%l in ('dir /AL /B') do (
set foundSymlink=true
echo Found symlink: %%l
)

REM Check if any symbolic links were found
if "!foundSymlink!"=="false" (
echo No symbolic links found in: !modRootDir!
pause
exit /b
)

REM Prompt the user for confirmation once to delete all symbolic links
set /p confirmDelete="Do you want to delete all symlinks in this directory? [Y/N]: "
if /i "!confirmDelete!" NEQ "Y" (
echo Operation canceled. No symlinks were removed.
pause
exit /b
)

:: Removing symbolic links from the mod folder
for /d %%i in ("%targetDir%\*") do (
set "folderName=%%~nxi"
fsutil reparsepoint query "%%i" > nul 2>&1
if not errorlevel 1 (
rmdir /s /q "%%i"
echo Removed symlink in "%%i"
REM Remove all symlinks in the mod directory
echo.
echo Deleting all symbolic links in: !modRootDir!
for /f "tokens=*" %%l in ('dir /AL /B') do (
echo Removing symlink: %%l
rmdir "%%l"
if !errorlevel! == 0 (
echo Successfully removed symlink: %%l
) else (
echo Failed to remove symlink: %%l. Check permissions or path issues.
)
)

REM Completion message
echo.
echo All symbolic links have been removed from: !modRootDir!
pause

0 comments on commit 0e876dd

Please sign in to comment.