Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't create filenames longer than 255 characters #6299

Merged
merged 1 commit into from
Nov 13, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,7 @@ public String visualizeBlockTransferInputAfter(Block bb, Analysis<V, S, T> analy
*/
protected String dotOutputFileName(UnderlyingAST ast) {
StringBuilder srcLoc = new StringBuilder();
StringBuilder outFile = new StringBuilder(outDir);

outFile.append("/");
StringBuilder outFile = new StringBuilder();

if (ast.getKind() == UnderlyingAST.Kind.ARBITRARY_CODE) {
CFGStatement cfgStatement = (CFGStatement) ast;
Expand Down Expand Up @@ -264,8 +262,13 @@ protected String dotOutputFileName(UnderlyingAST ast) {
}
outFile.append(".dot");

// make path safe for Linux
if (outFile.length() > 255) {
outFile.setLength(255);
}
// make path safe for Windows
String outFileName = outFile.toString().replace("<", "_").replace(">", "");
String outFileBaseName = outFile.toString().replace("<", "_").replace(">", "");
String outFileName = outDir + "/" + outFileBaseName;

generated.put(srcLoc.toString(), outFileName);

Expand Down