Skip to content

Commit

Permalink
Fix some errors and add documentation and itterate version
Browse files Browse the repository at this point in the history
  • Loading branch information
nkalush committed Jan 4, 2019
1 parent f31cbdd commit 2feb5d1
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 14 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ build
*.pyc
*.7z
*.omod
*.fomod
*.fomod
*.exe
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Simple script to create a Fallout76Custom.ini for .ba2 mods installed
* __--datafolder__ Specify fallout76\'s data folder location (Default: current directory)
* __--inifolder__ Specify the folder where Fallout76Custom.ini lives (Default: C:\Users\[*current_user*]\Documents\My Games\Fallout 76)
* __--inifilename__ Specify the filename for the ini (Default: Fallout76Custom.ini)
* __--runasadmin__ Run the program as administrator, will ask for permission

## Info
I don't normally do python.. or windows... so sorry...
Expand Down
17 changes: 5 additions & 12 deletions createCustomIni.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
""" This module creates a fallout76Custom.ini file from the installed mods in the data directory """

import argparse
import ctypes
import errno
import os

#madogs: I *think* this is what I need to pull in
import ctypes
from os import walk
import sys

# Set the default home and mod directories
HOME_DIR = os.path.expanduser("~") + "\\Documents\\My Games\\Fallout 76"
Expand All @@ -23,21 +22,16 @@
' (Default: ' + HOME_DIR + ')')
PARSER.add_argument('--inifilename', default=FILENAME,
help='Specify the filename for the ini (Default: ' + FILENAME + ')')

# madogs: argument to run program as an administrator
# madogs: I'm uncertain of boolean syntax... case sensitive? is the user input case sensitive as well?
PARSER.add_argument('--runasadmin', default=False,
PARSER.add_argument('--runasadmin', action="store_true",
help='Runs as an admin. Use when Fallout 76'
+ 'installed in UAC location.'
+ 'installed in UAC location.')

ARGS = PARSER.parse_args()

# Assign arguments to variables
MODS_DIR = ARGS.datafolder
FILENAME = ARGS.inifilename
HOME_DIR = ARGS.inifolder + "\\" + FILENAME

# madogs: not certain of the syntax here
IS_ADMIN = ARGS.runasadmin

# Configuration arrays, these are mods that should go in specific
Expand Down Expand Up @@ -115,11 +109,10 @@
SR_2LIST_INDEX = 3

# madogs: checks if user set --runasadmin=True
if IS_ADMIN():
if IS_ADMIN:
# Re-run the program with admin rights
ctypes.windll.shell32.ShellExecuteW(None, "runas", sys.executable, __file__, None, 1)
else:
# madogs: main program
# Create any missing folders
if not os.path.exists(os.path.dirname(HOME_DIR)):
try:
Expand Down
2 changes: 1 addition & 1 deletion fomod/Info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<Description>Creates a Fallut76Custom.ini based on the installed .ba2 files</Description>
<Author>urbanpanda</Author>
<Website>https://github.com/toopandish/Fallout76CreateCustomIni</Website>
<Version>1.4</Version>
<Version>1.5</Version>
<Groups>
<element>Tools and Utilities</element>
</Groups>
Expand Down

0 comments on commit 2feb5d1

Please sign in to comment.