File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed
Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -99,8 +99,9 @@ def expand_prompts(
9999 sequence = 0
100100 for command in commands :
101101 sequence += 1
102+ format = _get_fn_format (outdir , sequence )
102103 parent_conn .send (
103- command + f' --fnformat="dp. { sequence :04 } .{{prompt}}.png "'
104+ command + f' --fnformat="{ format } "'
104105 )
105106 parent_conn .close ()
106107 else :
@@ -110,7 +111,17 @@ def expand_prompts(
110111 for p in children :
111112 p .terminate ()
112113
113-
114+ def _get_fn_format (directory :str , sequence :int )-> str :
115+ """
116+ Get a filename that doesn't exceed filename length restrictions
117+ on the current platform.
118+ """
119+ max_length = os .pathconf (directory ,'PC_NAME_MAX' )
120+ prefix = f'dp.{ sequence :04} .'
121+ suffix = '.png'
122+ max_length -= len (prefix )+ len (suffix )
123+ return f'{ prefix } {{prompt:0.{ max_length } }}{ suffix } '
124+
114125class MessageToStdin (object ):
115126 def __init__ (self , connection : Connection ):
116127 self .connection = connection
You can’t perform that action at this time.
0 commit comments