@@ -112,20 +112,24 @@ class PolyDeployConfig(TypedDict):
112112
113113def get_all_deployable_files_windows (config : PolyDeployConfig ) -> List [str ]:
114114 # Constructing the Windows command using dir and findstr
115- include_pattern = " " .join (f"*.{ f } " if "." in f else f"*. { f } " for f in config ["include_files_or_extensions" ]) or "*"
116- exclude_pattern = '| ' .join (config ["exclude_dirs" ])
117- pattern = '| ' .join (f"polyConfig: { name } " for name in config ["type_names" ]) or 'polyConfig'
115+ include_pattern = " " .join (f"*.{ f } " for f in config ["include_files_or_extensions" ]) or "*"
116+ exclude_pattern = ' ' .join (f" \\ { f } " for f in config ["exclude_dirs" ])
117+ pattern = ' ' .join (f"\\ < polyConfig: { name } \\ > " for name in config ["type_names" ]) or 'polyConfig'
118118
119- exclude_command = f" | findstr /V /I \" { exclude_pattern } \" " if exclude_pattern else ''
120- search_command = f" | findstr /M /I /F:/ /C:\" { pattern } \" "
119+ # Using two regular quotes or two smart quotes throws "The syntax of the command is incorrect".
120+ # For some reason, starting with a regular quote and leaving the end without a quote works.
121+ exclude_command = f" | findstr /V /I \" { exclude_pattern } " if exclude_pattern else ''
122+ search_command = f" | findstr /M /I /F:/ { pattern } "
121123
122124 result = []
123125 for dir_path in config ["include_dirs" ]:
124- dir_command = f"dir /S /P /B { include_pattern } { dir_path } "
126+ if dir_path is not '.' :
127+ include_pattern = " " .join (f"{ dir_path } *.{ f } " for f in config ["include_files_or_extensions" ]) or "*"
128+ dir_command = f"dir { include_pattern } /S /P /B"
125129 full_command = f"{ dir_command } { exclude_command } { search_command } "
126130 try :
127131 output = subprocess .check_output (full_command , shell = True , text = True )
128- result .extend (output .strip ().split ('\r \ n ' ))
132+ result .extend (output .strip ().split ('\n ' ))
129133 except subprocess .CalledProcessError :
130134 pass
131135 return result
@@ -154,7 +158,7 @@ def get_all_deployable_files(config: PolyDeployConfig) -> List[str]:
154158 if not config .get ("include_files_or_extensions" ):
155159 config ["include_files_or_extensions" ] = ["py" ]
156160 if not config .get ("exclude_dirs" ):
157- config ["exclude_dirs" ] = ["poly " , "node_modules" , "dist" , "build" , "output" , ".vscode" , ".poly" , ".github" , ".husky" , ".yarn" ]
161+ config ["exclude_dirs" ] = ["Lib " , "node_modules" , "dist" , "build" , "output" , ".vscode" , ".poly" , ".github" , ".husky" , ".yarn" , ".venv " ]
158162
159163 is_windows = os .name == "nt"
160164 if is_windows :
0 commit comments