Skip to content

Commit 32f3119

Browse files
authored
Merge pull request #17 from yugu0202/develop
パス取得方法の変更
2 parents f1f1a50 + b549d6e commit 32f3119

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

server.py

+9-8
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,22 @@ def main():
1414
parser = argparse.ArgumentParser(
1515
prog="compact CHaser Server",
1616
usage="py server.py <MAPPATH> [OPTIONS]",
17-
description="このプログラムはコマンドで簡単にCHaserの対戦を行うためのものです"
17+
description="このプログラムはコマンドライン上で簡単にCHaserの対戦を行うためのものです"
1818
)
1919
"""
2020
py server.py {map_path} --cport {cool_port} --hport {hot_port} --log {log_path}
2121
py server.py {map_path} -c {cool_port} -h {hot_port} -l {log_path}
2222
"""
23-
parser.add_argument("mappath", help="マップのパス")
24-
parser.add_argument("-f", "--firstport", default=2009, help="coolのポート")
25-
parser.add_argument("-s", "--secondport", default=2010, help="hotのポート")
26-
parser.add_argument("-l", "--log", default="./chaser.log", help="logのパス")
23+
parser.add_argument("mappath", help="マップのパス(実行ディレクトリから相対)")
24+
parser.add_argument("-f", "--firstport", default=2009, help="先攻のポート")
25+
parser.add_argument("-s", "--secondport", default=2010, help="後攻のポート")
26+
parser.add_argument("-l", "--log", default="./chaser.log", help="logの出力先(実行ディレクトリから相対)")
2727

2828
args = parser.parse_args()
2929

30-
map_path = os.path.abspath(args.mappath)
31-
log_path = os.path.abspath(args.log)
30+
base_path = os.getcwd()
31+
map_path = os.path.join(base_path, args.mappath)
32+
log_path = os.path.join(base_path, args.log)
3233

3334
if not os.path.exists(map_path):
3435
print(f"Error: map file not exists\npath: {map_path}", file=sys.stderr)
@@ -137,4 +138,4 @@ def action(data:str,character,logger):
137138
return recieve
138139

139140
if __name__ == "__main__":
140-
main()
141+
main()

0 commit comments

Comments
 (0)