Should I get an exception for paths exceeding MAX_PATH ? lazarus / 62-General ---------------------------------------------------------------------- jaz2014 · 2022-02-19 22:39 Running laz 2.2.0 I don't seem to get an exception for unexpected long paths. Is the only way to deal with this to put \\?\ in front of every file path action and is doing such safe (ie does it fail in any operations? Is it always carried forward?) Is there a better way to deal with this than that ? I'm finding the application just crashes into a race condition in assembler when I hit one of these paths. No warning at all (I'm inside try- except blocks) - the debugger doesnt go to source pascal - just 12 lines of anonymous assembler that seems to loop forever. I've seen mention of a "long path tool" by searching here but can't spot an actual link. thanks jaz ---------------------------------------------------------------------- marcov · 2022-02-19 22:43 Try going to Lazarus - > projects -> projects options -> application turn on the "manifest resource" and then select "long path awareness". ---------------------------------------------------------------------- jaz2014 · 2022-02-19 23:12 Thanks marcov .. That seems to have been checked on by default on install as is the use manifest resource box.  .. does it need anything else? I'm in {$mode Delphi} if that makes  a difference? I'll give the UTF-8 box a check anyway (its says windows  10 - I'm using win7) and see if that helps tommorow. ---------------------------------------------------------------------- marcov · 2022-02-19 23:46 The long path tick one is also win10 (some 2018 or 19 one) specific. Then no, I don't know a way around \\?\ ---------------------------------------------------------------------- jaz2014 · 2022-02-20 17:36 ok so I seem to have solved my issue I traced the fault down to path : ansistring; forcedirectories(path);  And forcedirectories('\\?\' + path) Also didnt work. Following the source code for forcedirectories leads back to delphi  which uses 'string' in the sysutils source. As this is Delphi there shouldnt be an issue as it uses 'string' as a container for longstring. (At least in D5 which is what I have - I assume thats delphi-universal) However - out of desperation I tried a cast forcedirectories(ansistring('\\?\' + path))  (Using ' if ... = true' also helps to track things down!) and that fixed it as far as I can tell. If I take the cast off - it fails again. I'm guessing the '\\?\' being a string in laz was an issue? I  think a fail to create deserves an exception as it creates a partial path (delphi should have stopped that maybe) but there could be a reason not to maybe. ---------------------------------------------------------------------- marcov · 2022-02-20 18:17 If you think there is a bug, please submit a complete program to the bugtracker. It is often safer to compile via the commandline, and add that commandline to the bugreport. Or a complete lazarus project (with .lpi), e.g. zipped.